HTML 

Hypertext Markup Language is a standard markup language used for creating World Wide Web pages.

Parsing 

Parsing is the process of syntactic analysis of a string of symbols. It involves resolving a string into its component parts and describing their syntactic roles.

HTMLParser 

An HTMLParser instance is fed HTML data and calls handler methods when start tags, end tags, text, comments, and other markup elements are encountered. 

Example (based on the original Python documentation):

_{Code}

from HTMLParser import HTMLParser

# create a subclass and override the handler methods
class MyHTMLParser(HTMLParser):
    def handle_starttag(self, tag, attrs):
        print "Found a start tag  :", tag
    def handle_endtag(self, tag):
        print "Found an end tag   :", tag
    def handle_startendtag(self, tag, attrs):
        print "Found an empty tag :", tag

# instantiate the parser and fed it some HTML
parser = MyHTMLParser()
parser.feed("<html><head><title>HTML Parser - I</title></head>"
            +"<body><h1>HackerRank</h1><br /></body></html>")

Output

Found a start tag  : html
Found a start tag  : head
Found a start tag  : title
Found an end tag   : title
Found an end tag   : head
Found a start tag  : body
Found a start tag  : h1
Found an end tag   : h1
Found an empty tag : br
Found an end tag   : body
Found an end tag   : html

.handle_starttag(tag, attrs)  

This method is called to handle the start tag of an element. (For example: <div class='marks'>) 

The tag argument is the name of the tag converted to lowercase. 

The attrs argument is a list of (name, value) pairs containing the attributes found inside the tag’s <> brackets.

.handle_endtag(tag)  

This method is called to handle the end tag of an element. (For example: </div>) 

The tag argument is the name of the tag converted to lowercase.

.handle_startendtag(tag,attrs) 

This method is called to handle the empty tag of an element. (For example: <br />) 

The tag argument is the name of the tag converted to lowercase. 

The attrs argument is a list of (name, value) pairs containing the attributes found inside the tag’s <> brackets.

Task

You are given an HTML code snippet of $N$ lines. 

Your task is to print start tags, end tags and empty tags separately. 

Format your results in the following way:

Start : Tag1
End   : Tag1
Start : Tag2
-> Attribute2[0] > Attribute_value2[0]
-> Attribute2[1] > Attribute_value2[1]
-> Attribute2[2] > Attribute_value2[2]
Start : Tag3
-> Attribute3[0] > None
Empty : Tag4
-> Attribute4[0] > Attribute_value4[0]
End   : Tag3
End   : Tag2

Here, the -> symbol indicates that the tag contains an attribute. It is immediately followed by the name of the attribute and the attribute value. 

The > symbol acts as a separator of the attribute and the attribute value.

If an HTML tag has no attribute then simply print the name of the tag. 

If an attribute has no attribute value then simply print the name of the attribute value as None.  

Note: Do not detect any HTML tag, attribute or attribute value inside the HTML comment tags (<!-- Comments -->).Comments can be multiline as well.

Input Format

The first line contains integer $N$, the number of lines in a HTML code snippet.

The next $N$ lines contain HTML code.

Constraints

$0<N<100$

Output Format

Print the HTML tags, attributes and attribute values in order of their occurrence from top to bottom in the given snippet.

Use proper formatting as explained in the problem statement.

Sample Input
2
<html><head><title>HTML Parser - I</title></head>
<body data-modal-target class='1'><h1>HackerRank</h1><br /></body></html>

Sample Output
Start : html
Start : head
Start : title
End   : title
End   : head
Start : body
-> data-modal-target > None
-> class > 1
Start : h1
End   : h1
Empty : br
End   : body
End   : html

Difficulty: EASY

Solutions:
from html.parser import HTMLParser

def print_attrs(attrs):
	for attr in attrs:
		print('->', attr[0], '>', attr[1])

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		print_attrs(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		print_attrs(attrs)
html = str()
for i in range(int(input())):
	html += input().rstrip() + '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		if attrs != None:
			for j in range(len(attrs)):
				if attrs[j][1] != None:
					print('-> ' + attrs[j][0] + ' > ' + attrs[j][1])
				else:
					print('-> ' + attrs[j][0] + ' > None')

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		if attrs != None:
			for j in range(len(attrs)):
				print('-> ' + attrs[j][0] + ' > ' + attrs[j][1])
parser = MyHTMLParser()
n = int(input())
for i in range(n):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		self._printattrs(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		self._printattrs(attrs)

	def _printattrs(self, attrs):
		for a in attrs:
			print('->', a[0], '>', a[1])
MyHTMLParser().feed(''.join([input() for _ in range(int(input()))]))


from html.parser import HTMLParser
s = ''.join((input().strip() for n in range(int(input()))))

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		self.print_attrs(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		self.print_attrs(attrs)

	def print_attrs(self, attrs):
		for attr in attrs:
			print('-> {} > {}'.format(*attr))
MyHTMLParser().feed(s)


import sys
from html.parser import HTMLParser
input()
body = ''.join(sys.stdin.readlines())

class Parser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : {}'.format(tag))
		for (k, v) in attrs:
			print('-> {} > {}'.format(k, v))

	def handle_endtag(self, tag):
		print('End   : {}'.format(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : {}'.format(tag))
		for (k, v) in attrs:
			print('-> {} > {}'.format(k, v))
parser = Parser()
parser.feed(body)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		if attrs is not None:
			for a in attrs:
				print('-> {} > {}'.format(*a))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		if attrs is not None:
			for a in attrs:
				print('-> {} > {}'.format(*a))
n = int(input())
parser = MyHTMLParser()
h = ''
for _ in range(n):
	h += input()
parser.feed(h)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])
n = int(input())
s = ''
for i in range(n):
	s += input() + '\n'
parser = MyHTMLParser()
parser.feed(s)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : %s' % str(tag))
		for attr in attrs:
			print('-> %s > %s' % attr)

	def handle_endtag(self, tag):
		print('End   : %s' % str(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : %s' % str(tag))
		for attr in attrs:
			print('-> %s > %s' % attr)
s = ''
for _ in range(int(input())):
	s += input()
MyHTMLParser().feed(s)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('-> {0} > {1}'.format(attr[0], attr[1]))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('-> {0} > {1}'.format(attr[0], attr[1]))
parser = MyHTMLParser()
for _ in range(int(input())):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handleAttrs(self, attrs):
		for (x, y) in attrs:
			print('-> {} > {}'.format(x, y))

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		self.handleAttrs(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		self.handleAttrs(attrs)
parser = MyHTMLParser()
txt = ''
for _ in range(int(input())):
	txt += input().strip()
parser.feed(txt)


import sys
from html.parser import HTMLParser
rl = lambda : sys.stdin.readline()
n = int(rl())
s = ''
for _ in range(n):
	s += rl()

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		if attrs:
			for attr in attrs:
				print('->', attr[0], '>', attr[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		if attrs:
			for attr in attrs:
				print('->', attr[0], '>', attr[1])

	def handle_comment(self, data):
		pass
parser = MyHTMLParser()
parser.feed(s)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		if attrs:
			for attr in attrs:
				print('->', attr[0], '>', attr[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		if attrs:
			for attr in attrs:
				print('->', attr[0], '>', attr[1])
parser = MyHTMLParser()
for _ in range(int(input(''))):
	parser.feed(input(''))


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		self.print_attrs(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		self.print_attrs(attrs)

	def print_attrs(self, attrs):
		for i in attrs:
			print('-> ' + i[0] + ' > ' + str(i[1]))
parser = MyHTMLParser()
string = ''
for i in range(int(input())):
	string += input()
	string += '\n'
parser.feed(string)


from html.parser import HTMLParser
N = int(input())
html = ''
for i in range(0, N):
	html += input()

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : {}'.format(tag))
		if len(attrs):
			for (a, b) in attrs:
				print('-> {} > {}'.format(a, b))

	def handle_endtag(self, tag):
		print('End   : {}'.format(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : {}'.format(tag))
		if len(attrs):
			for (a, b) in attrs:
				print('-> {} > {}'.format(a, b))
parser = MyHTMLParser()
parser.feed(html)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : {0}'.format(tag))
		for (key, val) in attrs:
			print('-> {0} > {1}'.format(key, val))

	def handle_endtag(self, tag):
		print('End   : {0}'.format(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : {0}'.format(tag))
		for (key, val) in attrs:
			print('-> {0} > {1}'.format(key, val))
parser = MyHTMLParser()
lines = []
n = int(input())
for i in range(n):
	lines.append(str(input()).strip())
parser.feed(''.join(lines))


import re
import shlex
N = int(input())
h = ''
for i in range(N):
	line = input()
	line = line.strip()
	h = h + ' ' + line
comment = False
s = []
l = len(h)
for (i, x) in enumerate(h):
	if x in '<>':
		if x == '<' and i < l - 4:
			if h[i + 1:i + 4] == '!--':
				comment = True
		if x == '>' and i > 4:
			if h[i - 2:i] == '--':
				comment = False
				continue
	if not comment:
		s.append(x)
s = ''.join(s)
tags = re.findall('<(\\/?\\w*)\\s?(.*?)\\s?(\\/?)>', s)
for x in tags:
	if x[0][0] == '/':
		print('End   : ' + x[0][1:])
	else:
		if x[2] == '/':
			print('Empty : ' + x[0])
		else:
			print('Start : ' + x[0])
		if len(x[1]) > 0:
			a = shlex.split(x[1])
			for att in a:
				if re.search('=', att):
					j = att.index('=')
					att0 = att[:j]
					att1 = att[j + 1:]
					print('-> ' + att0 + ' > ' + att1.replace("'", '').replace('"', ''))
				else:
					print('-> ' + att + ' > None')


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for item in attrs:
			print('->', item[0], '>', item[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for item in attrs:
			print('->', item[0], '>', item[1])
parser = MyHTMLParser()
s = ''
for i in range(int(input())):
	s += input()
parser.feed(s)


from html.parser import HTMLParser

class betterHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : %s' % tag)
		[print('-> %s > %s' % (name, value)) for (name, value) in attrs]

	def handle_endtag(self, tag):
		print('End   : %s' % tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty : %s' % tag)
		[print('-> %s > %s' % (name, value)) for (name, value) in attrs]
N = int(input())
S = ''.join([input() for i in range(N)])
goodparser = betterHTMLParser()
goodparser.feed(S)


from html.parser import HTMLParser
lokal = 0
if lokal:
	f = open('in.txt')
	inFkt = f.readline
else:
	inFkt = input
from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])
parser = MyHTMLParser()
html = ''
for i in range(int(inFkt())):
	html += inFkt()
	html += '\n'
parser.feed(html)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		if attrs:
			for (attr, value) in attrs:
				print('-> %s > %s' % (attr, value))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		if attrs:
			for (attr, value) in attrs:
				print('-> %s > %s' % (attr, value))
N = int(input())
html = ''.join([input() for _ in range(N)])
parser = MyHTMLParser()
parser.feed(html)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for e in attrs:
			print('-> ' + e[0] + ' > ' + str(e[1]))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for e in attrs:
			print('-> ' + e[0] + ' > ' + str(e[1]))
parser = MyHTMLParser()
N = int(input())
for _ in range(N):
	parser.feed(input())


from html.parser import HTMLParser
N = int(input())
S = ''
S = '\n'.join([input() for i in range(N)])

class MyHTMLParser(HTMLParser):

	def print_attrs(attrs):
		for attr in attrs:
			print('->', attr[0], '>', attr[1])

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		if attrs:
			MyHTMLParser.print_attrs(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		if attrs:
			MyHTMLParser.print_attrs(attrs)
parser = MyHTMLParser()
parser.feed(S)


import re
from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('{:6s}: {:s}'.format('Start', tag))
		for i in attrs:
			print('-> {:s} > {:s}'.format(i[0], str(i[1])))

	def handle_endtag(self, tag):
		print('{:6s}: {:s}'.format('End', tag))

	def handle_startendtag(self, tag, attrs):
		print('{:6s}: {:s}'.format('Empty', tag))
		for i in attrs:
			print('-> {:s} > {:s}'.format(i[0], str(i[1])))
parser = MyHTMLParser()
comment = False
for _ in range(int(input())):
	line = input()
	if comment:
		if re.search('-->', line):
			comment = False
			line = re.sub('.*?-->', '', line)
		else:
			continue
	line = re.sub('<!--.*?-->', '', line)
	if re.search('<!--', line):
		comment = True
		line = re.sub('<!--.*', '', line)
	parser.feed(line)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (name, value) in attrs:
			print('->', name, '>', value)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (name, value) in attrs:
			print('->', name, '>', value)
parser = MyHTMLParser()
str = ''
for i in range(int(input())):
	str += input()
parser.feed(str)


from html.parser import *
import re

class MyHTML(HTMLParser):

	def handle_starttag(self, tag, attr):
		print('Start : ' + tag)
		if len(attr) > 0:
			print('\n'.join(['-> ' + z[0] + ' > ' + str(z[1]) for z in attr]))

	def handle_startendtag(self, tag, attr):
		print('Empty : ' + tag)
		if len(attr) > 0:
			print('\n'.join(['-> ' + z[0] + ' > ' + str(z[1]) for z in attr]))

	def handle_endtag(self, tag):
		print('End   : ' + tag)
parser = MyHTML()
for _ in range(int(input())):
	parser.feed(input())


from html.parser import HTMLParser
__author__ = 'namii'

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for item in attrs:
			print('-> ' + str(item[0]) + ' > ' + str(item[1]))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for item in attrs:
			print('-> ' + str(item[0]) + ' > ' + str(item[1]))
parser = MyHTMLParser()
N = int(input())
contents = ''
for _ in range(N):
	contents += input()
parser.feed(contents)


from sys import stdin
from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : {}'.format(tag))
		for a in attrs:
			print('-> {} > {}'.format(*a))

	def handle_endtag(self, tag):
		print('End   : {}'.format(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : {}'.format(tag))
		for a in attrs:
			print('-> {} > {}'.format(*a))
n = int(stdin.readline().strip())
parser = MyHTMLParser()
parser.feed(stdin.read())


from html.parser import HTMLParser
count = int(input())
final_text = ''
while count > 0:
	text = input()
	final_text = final_text + text
	count = count - 1

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		if len(attrs) > 0:
			for (name, value) in attrs:
				print('-> ' + str(name) + ' > ' + str(value))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		if len(attrs) > 0:
			for (name, value) in attrs:
				print('-> ' + str(name) + ' > ' + str(value))
parser = MyHTMLParser()
parser.feed(final_text)


from html import parser
N = int(input())

class MyHTMLParser(parser.HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('-> ' + attr[0] + ' > ' + str(attr[1]))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('-> ' + attr[0] + ' > ' + str(attr[1]))
myparser = MyHTMLParser()
for _ in range(N):
	myparser.feed(input())
myparser.close()


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : ' + tag)
		for e in attrs:
			print('-> ' + e[0] + ' > ' + str(e[1]))

	def handle_endtag(self, tag):
		print('End   : ' + tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty : ' + tag)
		for e in attrs:
			print('-> ' + e[0] + ' > ' + str(e[1]))
parser = MyHTMLParser()
for _ in range(int(input())):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : {}'.format(tag))
		for (name, value) in attrs:
			print('-> {} > {}'.format(name, value))

	def handle_endtag(self, tag):
		print('End   : {}'.format(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : {}'.format(tag))
		for (name, value) in attrs:
			print('-> {} > {}'.format(name, value))
number = int(input())
s = ''
for i in range(number):
	s += input() + '\n'
MyHTMLParser().feed(s)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : {}'.format(tag))
		if attrs:
			for (a, v) in attrs:
				print('-> {} > {}'.format(a, v))

	def handle_endtag(self, tag):
		print('End   : {}'.format(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : {}'.format(tag))
		if attrs:
			for (a, v) in attrs:
				print('-> {} > {}'.format(a, v))
parser = MyHTMLParser()
for _ in range(int(input())):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for i in attrs:
			print('-> ' + str(i[0]) + ' > ' + str(i[1]))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for i in attrs:
			print('-> ' + str(i[0]) + ' > ' + str(i[1]))
parser = MyHTMLParser()
for i in range(int(input())):
	parser.feed(input())


from html.parser import HTMLParser

class MyParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start'.ljust(6, ' ') + ':', tag)
		for i in range(len(attrs)):
			print('->', attrs[i][0], '>', attrs[i][1])

	def handle_endtag(self, tag):
		print('End'.ljust(6, ' ') + ':', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty'.ljust(6, ' ') + ':', tag)
		for i in range(len(attrs)):
			print('->', attrs[i][0], '>', attrs[i][1])
(parser, n) = (MyParser(), '')
for i in range(int(input())):
	n += input().strip()
parser.feed(n)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for att in attrs:
			print('-> %s > %s' % (att[0], att[1]))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for att in attrs:
			print('-> %s > %s' % (att[0], att[1]))
N = int(input())
htmlText = []
for _ in range(N):
	htmlText.append(input())
parser = MyHTMLParser()
parser.feed(''.join(htmlText))


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (Name, Value) in attrs:
			print('-> %s > %s' % (Name, Value))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (Name, Value) in attrs:
			print('-> %s > %s' % (Name, Value))
parser = MyHTMLParser()
for _ in range(int(input().strip())):
	parser.feed(input().strip())


import re
num = int(input())
skip = False
long_string = ''
for it in range(num):
	long_string += input()
results = re.findall('<!-->|-->|<!--|<.*?>', long_string)
for result in results:
	if skip:
		if result.endswith('-->'):
			skip = False
		continue
	if result == '<!--':
		skip = True
		continue
	result = result.strip('<').strip('>')
	nodes = re.findall('\\s[^\\s]+="[^"]*"|\\s[^\\s]+=\\\'[^\\\']*\\\'|[^"\\\'\\s]+', result)
	endList = []
	wait_for_quote = False
	if nodes[-1] == '/':
		print('Empty : ' + nodes[0].strip("'").strip('"').strip(' '))
		nodes = nodes[:-1]
	elif result[0] == '/':
		print('End   : ' + nodes[0].strip('/'))
	else:
		print('Start : ' + nodes[0].strip("'").strip('"').strip(' '))
	for attributes in nodes[1:]:
		attribute = attributes.split('=', 1)
		print('-> ' + attribute[0].strip(' ').strip("'").strip('"') + ' > ' + (attribute[1].strip(' ').strip("'").strip('"') if len(attribute) > 1 else 'None'))


import re
N = int(input())
iText_Raw = '\n'.join([input() for i in range(N)])
iText = re.sub('<!--.*?-->', '', iText_Raw, flags=re.DOTALL)
TagDetect = re.finditer('</?\\w.*?>|<\\w.*?/>', iText, re.DOTALL)
for tag in TagDetect:
	tagText = tag.group(0)
	if tagText[:2] == '</':
		print('{:6}:'.format('End'), tagText[2:-1].strip())
	else:
		typeStr = 'Empty' if tagText[-2:] == '/>' else 'Start'
		tagTitle = re.search('(?<=^<)\\w[-\\w]*', tagText)
		print('{:6}:'.format(typeStr), tagTitle.group(0))
		contentText = tagText[tagTitle.end():-2] if typeStr == 'Empty' else tagText[tagTitle.end():-1]
		contentDetect = re.finditer('(\\w[-\\w]*)=["\'](.*?)["\']|\\w[-\\w]*', contentText)
		for content in contentDetect:
			contText = content.group(0)
			if '=' not in contText:
				print('->', contText, '>', 'None')
			else:
				print('->', content.group(1), '>', content.group(2))


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (arg0, arg1) in attrs:
			print('->', arg0, '>', arg1)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (arg0, arg1) in attrs:
			print('->', arg0, '>', arg1)
N = int(input())
S = ''
for _ in range(N):
	S += input()
parser = MyHTMLParser()
parser.feed(S)


import html.parser
import sys

class MyHTMLParser(html.parser.HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : {}'.format(tag))
		for (k, v) in attrs:
			print('-> {} > {}'.format(k, v))

	def handle_endtag(self, tag):
		print('End   : {}'.format(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : {}'.format(tag))
		for (k, v) in attrs:
			print('-> {} > {}'.format(k, v))
input()
p = MyHTMLParser()
p.feed(sys.stdin.read())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : %s' % tag)
		if attrs:
			for (name, value) in attrs:
				print('-> %s > %s' % (name, str(value)))

	def handle_endtag(self, tag):
		print('End   : %s' % tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty : %s' % tag)
		if attrs:
			for (name, value) in attrs:
				print('-> %s > %s' % (name, str(value)))
N = int(input())
string = ''
for _ in range(0, N):
	string += input()
myParser = MyHTMLParser()
myParser.feed(string)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			value = attr[1] if attr[1] else 'None'
			print('->', attr[0], '>', value)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			value = attr[1] if attr[1] else 'None'
			print('->', attr[0], '>', value)
parser = MyHTMLParser()
N = int(input())
html = ''.join((input() for _ in range(N)))
parser.feed(html)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (name, value) in attrs:
			print('->', name, '>', value)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (name, value) in attrs:
			print('->', name, '>', value)
parser = MyHTMLParser()
n = int(input().strip())
for i in range(n):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : {0}'.format(tag))
		self._print_attributes(attrs)

	def handle_endtag(self, tag):
		print('End   : {0}'.format(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : {0}'.format(tag))
		self._print_attributes(attrs)

	def _print_attributes(self, attrs):
		for kvp in attrs:
			print('-> {0} > {1}'.format(kvp[0], kvp[1]))
parser = MyHTMLParser()
for _ in range(int(input())):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		pass

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for a in attrs:
			print('->', a[0], '>', a[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for a in attrs:
			print('->', a[0], '>', a[1])
parser = MyHTMLParser()
for _ in range(int(input())):
	parser.feed(input())
parser.close()


from html.parser import HTMLParser

class SimpleHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : {0}'.format(tag))
		for (k, v) in attrs:
			print('-> {0} > {1}'.format(k, v))

	def handle_endtag(self, tag):
		print('End   : {0}'.format(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : {0}'.format(tag))
		for (k, v) in attrs:
			print('-> {0} > {1}'.format(k, v))
parser = SimpleHTMLParser()
for i in range(int(input())):
	parser.feed(input())


import re
s = ''.join([input() for _ in range(int(input()))])
for m in re.finditer('<!--.*?-->|(<.*?>)', s):
	t = m.group(1)
	if not t:
		continue
	m = re.match('< *(\\/?) *(\\w+) *(.*?) *(\\/?) *>', t)
	if m:
		if m.group(1) == '/':
			print('End   : ' + m.group(2))
		else:
			if m.group(4) == '/':
				print('Empty : ' + m.group(2))
			else:
				print('Start : ' + m.group(2))
			for ma in re.finditer('([^\\s=]+)(?: *= *[\'\\"](.+?)[\'\\"])?', m.group(3)):
				if ma.group(2):
					print('-> %s > %s' % (ma.group(1), ma.group(2)))
				else:
					print('-> %s > None' % (ma.group(1),))


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :'.center(1), tag)
		for a in attrs:
			if len(a) > 1 and a[1] is None:
				print('-> ' + a[0] + ' > None')
			else:
				print('-> ' + a[0] + ' > ' + a[1])

	def handle_endtag(self, tag):
		print('End   :'.center(1), tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :'.center(0), tag)
		for a in attrs:
			if len(a) > 1 and a[1] is None:
				print('-> ' + a[0] + ' > None')
			else:
				print('-> ' + a[0] + ' > ' + a[1])
n = int(input())
text = ''
for i in range(n):
	text += input()
parser = MyHTMLParser()
parser.feed(text)


from html.parser import HTMLParser
n = int(input())

class CustomerHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (attr, value) in attrs:
			print('-> {0} > {1}'.format(attr, value))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (attr, value) in attrs:
			print('-> {0} > {1}'.format(attr, value))
parser = CustomerHTMLParser()
for _ in range(n):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for x in attrs:
			print('-> {} > {}'.format(x[0], x[1]))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for x in attrs:
			print('-> {} > {}'.format(x[0], x[1]))
parser = MyHTMLParser()
this = ''
for _ in range(int(input())):
	this += input()
parser.feed(this)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		if attrs:
			for a in attrs:
				if a[1] is not None:
					print('-> ' + a[0] + ' > ' + a[1])
				else:
					print('-> ' + a[0] + ' > None')

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		if attrs:
			for a in attrs:
				if a[1] is not None:
					print('-> ' + a[0] + ' > ' + a[1])
				else:
					print('-> ' + a[0] + ' > None')
parser = MyHTMLParser()
for i in range(int(input())):
	parser.feed(input())


import re
from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (key, val) in attrs:
			print('-> {} > {}'.format(key, val))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (key, val) in attrs:
			print('-> {} > {}'.format(key, val))
parser = MyHTMLParser()
n = int(input().strip())
for i in range(n):
	text = input().strip()
	parser.feed(text)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		self._print_attrs(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		self._print_attrs(attrs)

	def handle_comment(self, data):
		pass

	def _print_attrs(self, attrs):
		if attrs:
			for attr in attrs:
				print('->', attr[0], '>', attr[1])
n = int(input())
s = ''
for _ in range(n):
	s += input()
parser = MyHTMLParser()
parser.feed(s)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		self.__print_attrs__(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		self.__print_attrs__(attrs)

	def __print_attrs__(self, attrs):
		for (name, value) in attrs:
			print('-> ' + name + ' > ' + (value if value else 'None'))
parser = MyHTMLParser()
for _ in range(int(input())):
	parser.feed(input())


from html.parser import HTMLParser

class HP(HTMLParser):

	def handle_starttag(self, t, a):
		print('Start :', t)
		for (x, y) in a:
			print('->', x, '>', y)

	def handle_endtag(self, t):
		print('End   :', t)

	def handle_startendtag(self, t, a):
		print('Empty :', t)
		for (x, y) in a:
			print('->', x, '>', y)
p = HP()
I = [input() for _ in range(int(input()))]
for x in I:
	p.feed(x)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for a in attrs:
			print('-> ' + a[0] + ' > ' + str(a[1]))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for a in attrs:
			print('-> ' + a[0] + ' > ' + str(a[1]))
parser = MyHTMLParser()
n = int(input())
parser.feed(''.join((input() for _ in range(n))))


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : ' + tag)
		for attr in attrs:
			print('-> ' + attr[0] + ' > ' + str(attr[1]))

	def handle_endtag(self, tag):
		print('End   : ' + tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty : ' + tag)
		for attr in attrs:
			print('-> ' + attr[0] + ' > ' + str(attr[1]))
parser = MyHTMLParser()
html = ''
for _ in range(int(input())):
	html += input()
parser.feed(html)


import html.parser, contextlib

class HRParser(html.parser.HTMLParser):
	for tt in 'start end empty'.split():

		def _handler(self, tag, attrs=(), *, tt=tt):
			print(tt.capitalize().ljust(5), ':', tag)
			for (attrn, attrv) in attrs:
				print('->', attrn, '>', attrv)
		vars()['handle_{}tag'.format(tt if tt != 'empty' else 'startend')] = _handler
with contextlib.closing(HRParser()) as hrp:
	for lno in range(int(input())):
		hrp.feed(input())


from html.parser import HTMLParser
import sys

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (key, value) in attrs:
			print('->', key, '>', value)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (key, value) in attrs:
			print('->', key, '>', value)
MyHTMLParser().feed(''.join(map(str.strip, sys.stdin.readlines()[1:])))


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (a, b) in attrs:
			print('->', a, '>', b)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (a, b) in attrs:
			print('->', a, '>', b)
parser = MyHTMLParser()
parser.feed('\n'.join([input() for i in range(int(input()))]))


from html.parser import HTMLParser

class MyParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : ' + tag)
		for (name, value) in attrs:
			print('-> ' + str(name) + ' > ' + str(value))

	def handle_endtag(self, tag):
		print('End   : ' + tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty : ' + tag)
		for (name, value) in attrs:
			print('-> ' + str(name) + ' > ' + str(value))
p = MyParser()
n = int(input())
for i in range(n):
	p.feed(input())


from html import parser

class MyHTMLParser(parser.HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (i, j) in attrs:
			print('->', i, '>', j)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (i, j) in attrs:
			print('->', i, '>', j)
t = int(input())
s = ''
for i in range(t):
	s += input()
par = MyHTMLParser()
par.feed(s)


import re
import html
from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (name, value) in attrs:
			print('->', name + ' >', value)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (name, value) in attrs:
			print('->', name + ' >', value)
parser = MyHTMLParser()
n = int(input())
for _ in range(n):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('-> %s > %s' % attr if len(attr) > 1 else '-> %s > None' % attr)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('-> %s > %s' % attr if len(attr) > 1 else '-> %s > None' % attr)
parser = MyHTMLParser()
for i in range(int(input())):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : %s' % tag)
		for a in attrs:
			print('-> %s > %s' % a)

	def handle_endtag(self, tag):
		print('End   : %s' % tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty : %s' % tag)
		for a in attrs:
			print('-> %s > %s' % a)
s = ' '.join([input() for _ in range(int(input()))])
parser = MyHTMLParser()
parser.feed(s)


import re

def split(s):
	spl = s.split()
	csl = []
	in_flag = False
	for a in spl:
		if not in_flag:
			csl.append(a)
			if '="' in a and a[-1] != '"':
				in_flag = True
		elif in_flag:
			csl[-1] += ' ' + a
			if a[-1] == '"':
				in_flag = False
	return csl

def print_tag_atr(s):
	atrs = split(s)
	name = atrs.pop(0)
	if '/>' in s:
		print('Empty : ' + name[1:])
	else:
		print('Start : ' + name[1:])
	for a in atrs:
		if a == '/>':
			break
		if '=' not in a:
			print('-> ' + a.strip('\'">') + ' > None')
		else:
			b = a.split('=', 1)
			print('-> ' + b[0].strip('\'">') + ' > ' + b[1].strip('\'">'))

def print_parse_line(s):
	tags = re.findall('\\<.*?\\>', s)
	for tag in tags:
		if re.match('\\<\\w*\\>', tag):
			print('Start : ' + re.match('\\<(\\w*)\\>', tag).group(1))
		elif re.match('\\<\\w* /\\>', tag):
			print('Empty : ' + re.match('\\<(\\w*) /\\>', tag).group(1))
		elif re.match('\\</\\w*\\>', tag):
			print('End   : ' + re.match('\\</(\\w*)\\>', tag).group(1))
		elif re.match('\\<[a-zA-z0-9-= \\\'\\"/,.:;&]*/?\\>', tag):
			print_tag_atr(re.match('\\<[a-zA-z0-9-= \\\'\\"/,.:;&]*/?\\>', tag).group())
		else:
			pass
in_comment = False
continuation = False
buffor = ''
for _ in range(int(input())):
	line = input().strip()
	if not in_comment:
		if '<!--' in line:
			if '-->' in line:
				line = re.sub('<!--.*-->', '', line)
			else:
				line = re.sub('<!--.*', '', line)
				in_comment = True
		if line:
			if not continuation:
				if '<' in line and '>' not in line:
					buffor += line
					continuation = True
				else:
					print_parse_line(line)
			elif continuation:
				if '>' in line:
					buffor += ' ' + line
					print_parse_line(buffor)
					buffor = ''
					continuation = False
				else:
					buffor += line
	else:
		if '-->' not in line:
			continue
		else:
			line = re.sub('.*-->', '', line)
			in_comment = False
		if line:
			print_parse_line(line)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : {}'.format(tag))
		if attrs:
			for (attr, val) in attrs:
				print('-> {} > {}'.format(attr, val))

	def handle_endtag(self, tag):
		print('End   : {}'.format(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : {}'.format(tag))
		if attrs:
			for (attr, val) in attrs:
				print('-> {} > {}'.format(attr, val))
n = int(input())
parser = MyHTMLParser()
s = ''
for _ in range(n):
	s += input()
parser.feed(s)


from html.parser import HTMLParser

class html_parser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (i, j) in attrs:
			print('->', i, '>', j)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (i, j) in attrs:
			print('->', i, '>', j)
parser = html_parser()
string = ''
N = int(input())
for k in range(N):
	string += input()
parser.feed(string)


import re, shlex
htmlx = ' '.join((input().strip() for _ in range(int(input()))))
html = re.sub('<!--.*?-->', '', htmlx)
tags = re.findall('<.*?>', html)
startptrn = re.compile('<(.*)>')
emptyptrn = re.compile('<(.*)/>')
endptrn = re.compile('</(.*)>')
for t in tags:
	starttag = startptrn.match(t)
	emptytag = emptyptrn.match(t)
	endtag = endptrn.match(t)
	if endtag != None:
		print('End   : ' + endtag.group(1))
	else:
		if emptytag != None:
			detail = re.split(' ', emptytag.group(1), 1)
			print('Empty : ' + detail[0])
		else:
			detail = re.split(' ', starttag.group(1), 1)
			print('Start : ' + detail[0])
		if len(detail) > 1:
			for field in shlex.split(detail[1]):
				if '=' in field:
					(attr, value) = re.split('=', field, 1)
					print('-> ' + attr + ' > ' + value.strip('"\''))
				else:
					print('-> ' + field + ' > ' + 'None')


from html.parser import HTMLParser

class MyHParser(HTMLParser):

	def handle_starttag(self, tag, att):
		print('Start :', tag)
		for (x, y) in att:
			print('->', x, '>', y)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, att):
		print('Empty :', tag)
		for (x, y) in att:
			print('->', x, '>', y)
p = MyHParser()
I = [input() for x in range(int(input()))]
for x in I:
	p.feed(x)


from html.parser import HTMLParser

class TagFinder(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		if attrs:
			self.print_attrs(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		if attrs:
			self.print_attrs(attrs)

	def print_attrs(self, attrs):
		for a in attrs:
			print('-> {} > {}'.format(a[0], a[1]))
n = int(input())
html = ''
for _ in range(n):
	html += input()
parser = TagFinder()
parser.feed(html)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for x in attrs:
			if x[1]:
				print('-> ' + x[0] + ' > ' + x[1])
			else:
				print('-> ' + x[0] + ' > None')

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for x in attrs:
			if x[1]:
				print('-> ' + x[0] + ' > ' + x[1])
			else:
				print('-> ' + x[0] + ' > None')
parser = MyHTMLParser()
for k in range(int(input())):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		self.printAttrs(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		self.printAttrs(attrs)

	def printAttrs(self, attrs):
		for a in attrs:
			print('->', a[0], '>', a[1])
parser = MyHTMLParser()
n = int(input().strip())
html = ''
for i in range(n):
	html += input()
parser.feed(html)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])
parser = MyHTMLParser()
n = int(input())
for i in range(0, n):
	parser.feed(input())


import html.parser
import re

class MyHTMLParser(html.parser.HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : ' + tag)
		if attrs != None:
			for (i, j) in attrs:
				if j == None:
					print('-> ' + str(i) + ' > ' + str(None))
				else:
					print('-> ' + str(i) + ' > ' + str(j))

	def handle_endtag(self, tag):
		print('End   : ' + tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty : ' + tag)
		if attrs != None:
			for (i, j) in attrs:
				if j == None:
					print('-> ' + str(i) + ' > ' + str(None))
				else:
					print('-> ' + str(i) + ' > ' + str(j))
parser = MyHTMLParser()
n = int(input())
s = ''
for i in range(n):
	s = s + input()
re.sub('<![.]*>', '', s)
parser.feed(s)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	@staticmethod
	def format_attr(attr):
		print('->', attr[0], '>', attr[1])

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			self.format_attr(attr)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			self.format_attr(attr)
html = ''
parser = MyHTMLParser()
for _ in range(int(input())):
	html += input()
parser.feed(html)


import html.parser

class HTMLParser(html.parser.HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		self.process_attrs(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		self.process_attrs(attrs)

	def process_attrs(self, attrs):
		for (name, value) in attrs:
			print('->', name, '>', value)
data = ''
for _ in range(int(input())):
	data += input()
parser = HTMLParser()
parser.feed(data)


from html.parser import HTMLParser

def print_attrs(attrs):
	for attr in attrs:
		print('->', attr[0], '>', attr[1])

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		print_attrs(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		print_attrs(attrs)
html = str()
for i in range(int(input())):
	html += input()
parser = MyHTMLParser()
parser.feed(html)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start', ':'.rjust(1, ' '), tag)
		for each in attrs:
			print('->', each[0], '>', each[1])

	def handle_endtag(self, tag):
		print('End', ':'.rjust(3, ' '), tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty', ':'.rjust(1, ' '), tag)
		for each in attrs:
			print('->', each[0], '>', each[1])
N = int(input())
result = []
for idx in range(N):
	result.append(input())
parser = MyHTMLParser()
parser.feed(''.join(result))


from html.parser import HTMLParser
import re

class prs(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for i in attrs:
			print('-> ' + i[0] + ' > ' + str(i[1]))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for i in attrs:
			print('-> ' + i[0] + ' > ' + str(i[1]))
a = ''
for i in range(int(input())):
	a += input().strip('\n')
b = re.sub('<!--.*?-->', '', a)
one = prs()
one.feed(b)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('->', ' > '.join(map(str, attr)))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('->', ' > '.join(map(str, attr)))
html = ''
for i in range(int(input())):
	html += input()
parser = MyHTMLParser()
parser.feed(html)
parser.close()


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])

	def handle_comment(self, data):
		pass
parser = MyHTMLParser()
N = int(input())
for i in range(N):
	html = input()
	parser.feed(html)


import re
from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start'.ljust(6) + ':', tag)
		for at in attrs:
			print('-> {} > {}'.format(at[0], at[1]))

	def handle_endtag(self, tag):
		print('End'.ljust(6) + ':', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty'.ljust(6) + ':', tag)
		for at in attrs:
			print('-> {} > {}'.format(at[0], at[1]))

def __starting_point():
	parser = MyHTMLParser()
	n = int(input().strip())
	for _ in range(n):
		line = input()
		parser.feed(line)
__starting_point()


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for (attr, value) in attrs:
			print('->', attr, '>', value)

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_data(self, data):
		pass

	def handle_comment(self, data):
		pass

	def handle_entityref(self, name):
		pass

	def handle_charref(self, name):
		pass

	def handle_decl(self, data):
		pass

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for (attr, value) in attrs:
			print('->', attr, '>', value)
inp = ''
for i in range(int(input())):
	inp += input()
parser = MyHTMLParser()
parser.feed(inp)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for a in attrs:
			(name, value) = a
			print('-> {} > {}'.format(name, value))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for a in attrs:
			(name, value) = a
			print('-> {} > {}'.format(name, value))
markup = ''
for _ in range(int(input())):
	markup += input()
parser = MyHTMLParser()
parser.feed(markup)


a = ''
for _ in range(int(input())):
	a += input()
import html.parser

class MyParser(html.parser.HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start : {}'.format(tag))
		for attr in attrs:
			print('-> {} > {}'.format(*attr))

	def handle_endtag(self, tag):
		print('End   : {}'.format(tag))

	def handle_startendtag(self, tag, attrs):
		print('Empty : {}'.format(tag))
		for attr in attrs:
			print('-> {} > {}'.format(*attr))
parser = MyParser()
parser.feed(a)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		data = ''

	def handle_starttag(self, tag, attrs):
		print('Start'.ljust(5), ':', tag)
		for a in attrs:
			print('-> ', end='')
			print(*a, sep=' > ')

	def handle_endtag(self, tag):
		print('End'.ljust(5), ':', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty'.ljust(5), ':', tag)
		for a in attrs:
			print('-> ', end='')
			print(*a, sep=' > ')
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])
html = ''
for i in range(int(input())):
	html += input()
parser = MyHTMLParser()
parser.feed(html)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('-> ' + str(attr[0]) + ' > ' + str(attr[1]))

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('-> ' + str(attr[0]) + ' > ' + str(attr[1]))
parser = MyHTMLParser()
for _ in range(int(input())):
	parser.feed(input())


from html.parser import HTMLParser

def read_int():
	return int(input())

def read_int_words():
	return map(int, input().split())

def pa(a):
	for ai in a:
		(k, v) = ai
		print('->', k.strip(), '>', str(v).strip())

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag.strip())
		pa(attrs)

	def handle_endtag(self, tag):
		print('End   :', tag.strip())

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag.strip())
		pa(attrs)
n = int(input())
parser = MyHTMLParser()
for i in range(n):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])
parser = MyHTMLParser()
N = int(input())
s = ''
for i in range(N):
	s = s + input().strip()
parser.feed(s)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		if attrs:
			for i in attrs:
				print('->', i[0], '>', i[1])

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		if attrs:
			for i in attrs:
				print('->', i[0], '>', i[1])

	def handle_endtag(self, tag):
		print('End   :', tag)
parser = MyHTMLParser()
for _ in range(int(input())):
	parser.feed(input())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		if attrs:
			for a in attrs:
				print('->', a[0], '>', a[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		if attrs:
			for a in attrs:
				print('->', a[0], '>', a[1])
html = []
for _ in range(int(input())):
	html.append(input())
parser = MyHTMLParser()
parser.feed(' '.join(html))


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_starttag(self, tag, attrs):
		print('Start :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])

	def handle_endtag(self, tag):
		print('End   :', tag)

	def handle_startendtag(self, tag, attrs):
		print('Empty :', tag)
		for attr in attrs:
			print('->', attr[0], '>', attr[1])
parser = MyHTMLParser()
for n in range(int(input())):
	s = input()
	parser.feed(s)