#!/usr/bin/python

import sys
import re

def makeGoodString(string):
    i = 0
    while i < len(string):
	if string[i] == '"':
            string = string[0:i] +  '\\"' + string[i+1:len(string)]
            i = i + 1
        i= i + 1
    return string 

def printAction(id, who, what):
    print newBNode() + '\n'
    print '    bmcb:label "' + id + '";\n'
    print '    bmcb:assignee [ bmcb:name "' + who + '"];\n'
    print '    bmcb:shortDesc "' + makeGoodString(what) + '".\n'

bnodeCount = 0
def newBNode():
    global bnodeCount
    bnodeCount = bnodeCount + 1
    return '_:a' + str(bnodeCount)

actionCount = 0

dateRe = re.compile('^date:\s*(2\S+)')
action1Re = re.compile('^ACTION:?\s+(\d\S+)\s+(\S+)\s*(.*)\r?$')
action2Re = re.compile('^ACTION:?\s+(\S*)\s+(.*)\r?$')

data = sys.stdin.readline()
while data != '':

# there is a persistent \r on the end of the strings
# looks like a regexp bug to me
# so get rid if it the hard way

    length = len(data)
    while length > 0 and (data[length-1]=='\r' or data[length-1] == '\n'):
        data = data[0:length-1]
        length = (length - 1)

#   check for a date
    match = dateRe.findall(data)
    if len(match) > 0:
        date = match[0]
        dateChecker = re.compile(date + '\#\d+') 

    match = action1Re.findall(data)
    if len(match) > 0:
        action1Re.findall(data)
        if len(match) > 0:
            id = match[0][0]
            who = match[0][1]
            what = match[0][2]
            if dateChecker.match(id):
                printAction(id, who, what)
    else:
	match = action2Re.findall(data)
        if len(match) > 0:
            actionCount = actionCount + 1
            id = date + '#' + str(actionCount)
            who = match[0][0]
            what = match[0][1]
            printAction(id, who, what) 
    
    data = sys.stdin.readline()

