*This section assumes that you understand the basics discussed in HTML Parser - Part 1

.handle_comment(data) 

This method is called when a comment is encountered (e.g. <!--comment-->). 

The data argument is the content inside the comment tag:

from HTMLParser import HTMLParser

class MyHTMLParser(HTMLParser):
    def handle_comment(self, data):
          print "Comment  :", data

.handle_data(data) 

This method is called to process arbitrary data (e.g. text nodes and the content of <script>...</script> and <style>...</style>). 

The data argument is the text content of HTML.

from HTMLParser import HTMLParser

class MyHTMLParser(HTMLParser):
    def handle_data(self, data):
        print "Data     :", data

Task

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

Your task is to print the single-line comments, multi-line comments and the data. 

Print the result in the following format:

>>> Single-line Comment  
Comment
>>> Data                 
My Data
>>> Multi-line Comment  
Comment_multiline[0]
Comment_multiline[1]
>>> Data
My Data
>>> Single-line Comment:  

Note: Do not print data if data == '\n'.  

Input Format

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

The next $N$ lines contains HTML code.

Constraints

$0<N<100$

Output Format

Print the single-line comments, multi-line comments and the data in order of their occurrence from top to bottom in the snippet.

Format the answers as explained in the problem statement.

Sample Input
4
<!--[if IE 9]>IE9-specific content
<![endif]-->
<div> Welcome to HackerRank</div>
<!--[if IE 9]>IE9-specific content<![endif]-->

Sample Output
>>> Multi-line Comment
[if IE 9]>IE9-specific content
<![endif]
>>> Data
 Welcome to HackerRank
>>> Single-line Comment
[if IE 9]>IE9-specific content<![endif]

Source: hackerrank | Difficulty: EASY


Solutions:
from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_data(self, data):
		if data == '\n':
			return
		print('>>> Data')
		print(data)

	def handle_comment(self, data):
		if data == '\n':
			return
		comments = data.split('\n')
		if len(comments) == 1:
			print('>>> Single-line Comment')
		else:
			print('>>> Multi-line Comment')
		print(*comments, sep='\n')
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_comment(self, data):
		lines = data.split('\n')
		print('>>> Multi-line Comment' if len(lines) > 1 else '>>> Single-line Comment')
		for line in lines:
			print(line)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data', data, sep='\n')
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


from html.parser import HTMLParser
import re

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		if re.search('\\n', data):
			print('>>> Multi-line Comment\n%s' % data)
		else:
			print('>>> Single-line Comment\n%s' % data)

	def handle_data(self, data):
		if re.search('[^\\s]+', data):
			print('>>> Data\n%s' % data)
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_comment(self, data):
		if '\n' in data:
			print('>>> Multi-line Comment')
			print(data)
		else:
			print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if data == '\n':
			pass
		else:
			print('>>> Data')
			print(data)
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_data(self, data):
		if data != '\n':
			print('>>> Data\n' + data)

	def handle_comment(self, data):
		if len(data.split('\n')) > 1:
			print('\n'.join(['>>> Multi-line Comment'] + [data]))
		else:
			print('>>> Single-line Comment\n' + data)
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_comment(self, data):
		if data != '\n':
			lines = data.split('\n')
			print('>>> Multi-line Comment' if len(lines) > 1 else '>>> Single-line Comment')
			for l in lines:
				print(l)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_comment(self, comment):
		if '\n' in comment:
			print('>>> Multi-line Comment\n%s' % comment)
		else:
			print('>>> Single-line Comment\n%s' % comment)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data\n%s' % data)
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_comment(self, data):
		if data.count('\n') >= 1:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_comment(self, data):
		if data != '\n':
			l = data.split('\n')
			if len(l) == 1:
				print('>>> Single-line Comment')
				print(data)
			else:
				print('>>> Multi-line Comment')
				print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_comment(self, data):
		comments = data.split('\n')
		if len(comments) == 1:
			print('>>> Single-line Comment')
		else:
			print('>>> Multi-line Comment')
		for comment in comments:
			if comment != '\n':
				print(comment)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_data(self, data):
		if data.strip():
			print('>>> Data\n{}'.format(data))

	def handle_comment(self, data):
		print('>>> ' + ('Single' if '\n' not in data else 'Multi') + '-line Comment\n{}'.format(data))
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_comment(self, data):
		if '\n' in data:
			print('>>> Multi-line Comment')
			print(data)
		else:
			print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if data.strip():
			print('>>> Data')
			print(data)
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


import html.parser

class HTMLParser(html.parser.HTMLParser):

	def handle_comment(self, data):
		if len(data.strip()) == 0:
			return
		num_breaks = data.count('\n')
		print('>>> Single-line Comment' if num_breaks == 0 else '>>> Multi-line Comment')
		print(data)

	def handle_data(self, data):
		if len(data.strip()) == 0:
			return
		print('>>> Data')
		print(data)
html_data = '\n'.join((input() for _ in range(int(input()))))
parser = HTMLParser()
parser.feed(html_data)


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		if data != '\n':
			if data.count('\n') > 0:
				print('>>> Multi-line Comment ')
			else:
				print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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 CustomHTMLParser(HTMLParser):

	def handle_comment(self, data):
		number_of_line = len(data.split('\n'))
		if number_of_line > 1:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		if data.strip():
			print(data)

	def handle_data(self, data):
		if data.strip():
			print('>>> Data')
			print(data)
parser = CustomHTMLParser()
n = int(input())
html_string = ''
for i in range(n):
	html_string += input().rstrip() + '\n'
parser.feed(html_string)
parser.close()


import html.parser
import sys

class MyHTMLParser(html.parser.HTMLParser):

	def handle_comment(self, data):
		if '\n' in data:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		print(data)

	def handle_data(self, data):
		if not data.strip():
			return
		print('>>> Data')
		print(data)
input()
p = MyHTMLParser()
p.feed(sys.stdin.read())


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)

	def handle_comment(self, data):
		text = data.replace('\n', '')
		if text != data:
			print('>>> Multi-line Comment')
			print(data)
		else:
			print('>>> Single-line Comment')
			print(data)
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_comment(self, data):
		prefix = '\n' in data and 'Multi-line Comment' or 'Single-line Comment'
		print('>>> {0}\n{1}'.format(prefix, data))

	def handle_data(self, data):
		if data is not '\n':
			print('>>> Data\n{0}'.format(data))
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_comment(self, data):
		if '\n' in data:
			print('>>> Multi-line Comment\n%s' % data)
		else:
			print('>>> Single-line Comment\n%s' % data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data\n%s' % data)
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_comment(self, data):
		if '\n' not in data:
			print('>>> Single-line Comment')
			print(data)
		elif '\n' in data:
			print('>>> Multi-line Comment')
			print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


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

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		if len(data.strip()) > 0 and data.count('\n') > 0:
			print('>>> Multi-line Comment')
			print(data)
		if len(data) > 0 and data.count('\n') == 0:
			print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if len(data.strip()) > 0:
			print('>>> Data')
			print(data)
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_comment(self, data):
		if not data == '\n':
			if '\n' in data:
				print('>>> Multi-line Comment')
				print(data)
			else:
				print('>>> Single-line Comment')
				print(data)

	def handle_data(self, data):
		if not data == '\n':
			print('>>> Data')
			print(data)
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_comment(self, data):
		if data != '\n':
			if '\n' in data:
				print('>>> Multi-line Comment')
			else:
				print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_comment(self, data):
		l = str(data).split('\n')
		if len(l) > 1:
			print('>>> Multi-line Comment')
			print(data)
		else:
			print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


from html.parser import HTMLParser
import re

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		m = re.search('[\\n]{1}', data)
		if m:
			print('>>> Multi-line Comment\n' + data)
		else:
			print('>>> Single-line Comment\n' + data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data\n' + data)
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_comment(self, data):
		lines = data.split('\n')
		if len(lines) > 1:
			print('>>> Multi-line Comment')
			for item in lines:
				print(item)
		else:
			print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if len(data.rstrip()) > 0:
			print('>>> Data')
			print(data)
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_data(self, data):
		if data != '\n':
			print('>>> Data')
			print('%s' % data)

	def handle_comment(self, data):
		if data.count('\n') >= 1:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		print(data)
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_comment(self, data):
		if '\n' in data:
			if data != '\n':
				print('>>> Multi-line Comment')
				print(data)
		elif data != '\n':
			print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


from html.parser import HTMLParser
import re

class MyHTMLParser(HTMLParser):

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)

	def handle_comment(self, data):
		s = data.split('\n')
		if len(s) > 1:
			print('>>> Multi-line Comment')
			for i in range(len(s)):
				print(s[i])
		else:
			print('>>> Single-line Comment')
			print(data)
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_comment(self, data):
		if data.strip():
			lines = str(data).split('\n')
			print('>>> ', 'Multi' if len(lines) > 1 else 'Single', '-line Comment', sep='')
			print(*lines, sep='\n')

	def handle_data(self, data):
		if data.strip():
			print('>>> Data')
			print(data)
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_comment(self, data):
		if '\n' in data:
			print('>>>', 'Multi-line Comment')
		else:
			print('>>>', 'Single-line Comment')
		print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>>', 'Data')
			print(data)
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


from html.parser import HTMLParser
html = ''

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		if '\n' in data:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_comment(self, data):
		if '\n' in data:
			print('>>> Multi-line Comment\n{}'.format(data))
		else:
			print('>>> Single-line Comment\n{}'.format(data))

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data\n{}'.format(data))
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


import sys
from html.parser import HTMLParser
rl = lambda : sys.stdin.readline()

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		if '\n' in data:
			print('>>> Multi-line Comment')
			print('\n'.join(data.split('\n')))
		else:
			print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if not data == '\n':
			print('>>> Data')
			print(data)
html = ''
for i in range(int(rl())):
	html += rl().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		if len(data.split('\n')) == 1:
			print('>>> Single-line Comment', data, sep='\n')
		elif len(data.split('\n')) > 1:
			print('>>> Multi-line Comment')
			for d in data.split('\n'):
				print(d)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data', data, sep='\n')
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_comment(self, data):
		if data != '\n':
			if '\n' not in data:
				print('>>> Single-line Comment')
				print(data)
			else:
				print('>>> Multi-line Comment')
				print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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 Parser(HTMLParser):

	def handle_comment(self, body):
		title = 'Multi' if '\n' in body else 'Single'
		print('>>> {}-line Comment\n{}'.format(title, body))

	def handle_data(self, body):
		if body != '\n':
			print('>>> Data\n{}'.format(body))
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = Parser()
parser.feed(html)
parser.close()


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		if data.strip():
			if data.find('\n') != -1:
				print('>>> Multi-line Comment')
			else:
				print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if data.strip():
			print('>>> Data')
			print(data)
n = int(input())
s = ''
for i in range(n):
	s += input() + '\n'
parser = MyHTMLParser()
parser.feed(s)


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_comment(self, data):
		if '\n' not in data:
			print('>>> Single-line Comment')
			print(data)
		else:
			print('>>> Multi-line Comment')
			for d in data.split('\n'):
				print(d.strip())

	def handle_data(self, data0):
		data1 = data0.rstrip()
		if data1 == '':
			return
		print('>>> Data')
		print(data1)
n = int(input())
parser = MyHTMLParser()
for i in range(n):
	parser.feed(input() + '\n')


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		data = data.split('\n')
		if len(data) > 1:
			print('>>> Multi-line Comment', *data, sep='\n')
		else:
			print('>>> Single-line Comment', data[0], sep='\n')

	def handle_data(self, data):
		data = [x for x in data.split('\n') if x.strip() != '']
		if len(data) > 0:
			print('>>> Data', *data, sep='\n')
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_comment(self, data):
		print('>>>', 'Multi-line' if '\n' in data else 'Single-line', 'Comment')
		print(data)

	def handle_data(self, data):
		if not data == '\n':
			print('>>> Data', data, sep='\n')
MyHTMLParser().feed('\n'.join([input().rstrip() for _ in range(int(input()))]))


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)

	def handle_comment(self, data):
		if data == '\n':
			return
		if data.count('\n') > 0:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		print(data)
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_comment(self, data):
		if data.count('\n') > 0:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		print(data)

	def handle_data(self, data):
		if len(data) > 1:
			print('>>> Data')
			print(data)
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_comment(self, data):
		if '\n' not in data:
			print('>>> Single-line Comment\n' + data.strip())
		else:
			print('>>> Multi-line Comment\n' + data.strip())

	def handle_data(self, data):
		if data == '\n':
			return
		print('>>> Data\n' + data)
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_comment(self, data):
		print('>>> Multi-line Comment' if '\n' in data else '>>> Single-line Comment')
		print(data.replace('\r', '\n'))

	def handle_data(self, data):
		if data.strip():
			print('>>> Data')
			print(data)
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_comment(self, data):
		if '\n' in data and data != '\n':
			print('>>> Multi-line Comment \n{}'.format(data.strip()))
		elif data != '\n':
			print('>>> Single-line Comment \n{}'.format(data.strip()))

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data\n{}'.format(data))
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_comment(self, data):
		if data.count('\n') == 0:
			print('>>> Single-line Comment')
		else:
			print('>>> Multi-line Comment')
		print(data)

	def handle_data(self, data):
		if data.strip() != '':
			print('>>> Data')
			print(data)
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_data(self, data):
		if len(data.strip()) > 0:
			print('>>> Data')
			print(data)

	def handle_comment(self, data):
		arr = data.split('\n')
		if len(arr) > 1:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		for i in arr:
			print(i)
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_comment(self, data):
		s = data.split('\n')
		if len(s) > 1:
			print('>>> Multi-line Comment')
			print('\n'.join(s))
		else:
			print('>>> Single-line Comment')
			print('\n'.join(s))

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_comment(self, data):
		if data.find('\n') != -1:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_comment(self, data):
		if data.count('\n') == 0:
			print('>>> Single-line Comment\n' + data)
		else:
			print('>>> Multi-line Comment\n' + data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data\n' + data)
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_comment(self, data):
		if '\n' in data:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)

	def handle_comment(self, data):
		datas = data.split('\n')
		if len(datas) != 1:
			print('>>> Multi-line Comment')
			print(data)
		else:
			print('>>> Single-line Comment')
			print(data)
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_comment(self, data):
		if not '\n' in data:
			print('>>> Single-line Comment', data, sep='\n')
		else:
			print('>>> Multi-line Comment', data, sep='\n')

	def handle_data(self, data):
		if not data == '\n':
			print('>>> Data', data, sep='\n')
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_comment(self, comment):
		print('>>> {}-line Comment'.format('Multi' if '\n' in comment else 'Single'), comment, sep='\n')

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data', data, sep='\n')
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_data(self, data):
		if data != '\n':
			print('>>> Data')
		print(data, end='')

	def handle_comment(self, data):
		datas = data.split('\n')
		if len(datas) != 1:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		print(data, end='')
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_comment(self, data):
		if not data.rstrip():
			return
		if data.count('\n'):
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		print(data)

	def handle_data(self, data):
		if not data.rstrip():
			return
		print('>>> Data')
		print(data)
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_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)

	def handle_comment(self, data):
		m = data.split('\n')
		if len(m) > 1:
			print('>>> Multi-line Comment')
			for i in m:
				print(i)
		else:
			print('>>> Single-line Comment')
			print(m[0])
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):
		pass

	def handle_endtag(self, tag):
		pass

	def handle_data(self, data):
		if not data.count('\n'):
			print('>>>', 'Data')
			print(data)

	def handle_comment(self, data):
		if data.count('\n'):
			print('>>>', 'Multi-line Comment')
		else:
			print('>>>', 'Single-line Comment')
		print(data)

	def handle_entityref(self, name):
		pass

	def handle_charref(self, name):
		pass

	def handle_decl(self, data):
		pass

	def handle_startendtag(self, tag, attrs):
		pass
inp = ''
for i in range(int(input())):
	inp += input() + '\n'
parser = MyHTMLParser()
parser.feed(inp)
parser.close()


from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		if data == '\n':
			return
		if '\n' in data:
			print('>>> Multi-line Comment')
			print(data)
		else:
			print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if data == '\n':
			return
		print('>>> Data')
		print(data)
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_comment(self, data):
		lines = str(data).split('\n')
		if len(lines) > 1:
			print('>>> Multi-line Comment')
			print(*lines, sep='\n')
		else:
			print('>>> Single-line Comment')
			print(*lines)

	def handle_data(self, data):
		if data.strip():
			print('>>> Data')
			print(data)
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_comment(self, data):
		comments = data.split('\n')
		print('>>> {0}-line Comment'.format('Multi' if len(comments) > 1 else 'Single'))
		print('\n'.join(comments))

	def handle_data(self, data):
		if not data.isspace():
			print('>>> Data', data, sep='\n')
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_comment(self, data):
		data = data.split('\n')
		if len(data) > 1:
			print('>>> Multi-line Comment')
			for n in range(len(data)):
				print(data[n])
		else:
			print('>>> Single-line Comment')
			print(''.join(data))

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


from html.parser import HTMLParser
import re

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		if data != '\n':
			if len(re.findall('\n', data, re.M)) > 0:
				print('>>> Multi-line Comment')
			else:
				print('>>> Single-line Comment')
			print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_data(self, data):
		if '\n' not in data:
			print('>>> Data')
			print(data)

	def handle_comment(self, data):
		if len(data.split('\n')) == 1:
			print('>>> Single-line Comment')
			print(data)
		else:
			print('>>> Multi-line Comment')
			for line in data.split('\n'):
				print(line)
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_comment(self, data):
		print('>>> ', 'Multi' if data.find('\n') + 1 else 'Single', '-line Comment\n', data, sep='')

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data\n' + data)
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_comment(self, cum):
		data = cum.split('\n')
		if len(data) > 1:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		for x in data:
			print(x)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			for x in data.split('\n'):
				print(x)
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_comment(self, data):
		print('>>> Multi-line Comment' if '\n' in data else '>>> Single-line Comment')
		print(data)

	def handle_data(self, data):
		if len(data) > 1:
			print('>>> Data')
			print(data)
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_comment(self, data):
		single = 'Multi' if '\n' in data else 'Single'
		print('>>> {}-line Comment\n{}'.format(single, data))

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data\n', data, 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_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)

	def handle_comment(self, data):
		if data != '\n':
			print('>>> Multi-line Comment' if data.count('\n') else '>>> Single-line Comment')
			print(data)
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_comment(self, data):
		print('>>> Multi-line Comment' if '\n' in data else '>>> Single-line Comment')
		print(data.replace('\r', '\n'))

	def handle_data(self, data):
		if data.strip():
			print('>>> Data')
			print(data.replace('\r', '\n'))
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()


from html.parser import HTMLParser
__author__ = 'namii'

class MyHTMLParser(HTMLParser):

	def handle_comment(self, data):
		multiline_comment = '\n' in data
		if multiline_comment:
			print('>>> Multi-line Comment')
		else:
			print('>>> Single-line Comment')
		print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_comment(self, data):
		prefix = 'Multi' if '\n' in data else 'Single'
		print('>>> {}-line Comment'.format(prefix))
		print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_comment(self, data):
		print('>>> Single-line Comment' if -1 == data.find('\n') else '>>> Multi-line Comment')
		print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data')
			print(data)
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_comment(self, data):
		if '\n' not in data:
			print('>>> Single-line Comment')
			print(data)
		else:
			ds = data.split('\n')
			if ds:
				print('>>> Multi-line Comment')
				print(data)

	def handle_data(self, data):
		if '\n' not in data:
			print('>>> Data')
			print(data)
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_comment(self, data):
		commentTitle = 'Single'
		if data.find('\n') > -1:
			commentTitle = 'Multi'
		print('>>> ' + commentTitle + '-line Comment')
		print(data)

	def handle_data(self, data):
		if data != '\n':
			print('>>> Data', data, sep='\n')
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_comment(self, data):
		if data.count('\n') == 0:
			print('>>> Single-line Comment')
		else:
			print('>>> Multi-line Comment')
		print(data)

	def handle_data(self, data):
		if data == '\n':
			return
		print('>>> Data')
		print(data)
html = ''
for i in range(int(input())):
	html += input().rstrip()
	html += '\n'
parser = MyHTMLParser()
parser.feed(html)
parser.close()