Buggy python submission (verdict: Runtime Error):
while True:
	player_nun = int(input())
	if player_nun == 0:
		break
	whole_data = []
	
	xel = {}
	for i in (0, player_nun):
		dat = input().split()
		p_data = []
		p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
			whole_data.append(p_data)
		for x in p_data[2:p_data[1]]:
			if xel.has_key(x) == False:
				0 = xel[x]
				xel[x] += 1
			else:
				xe;[x] += 1
		
	score = {}
	for y in xel.keys():
		5 - xel[y] = score[y]
		
	result = []
	for i in whoe_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
		
	min_score = min(x[1] for x in result)
	winnners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + winners.sorted[0])
			
	
			

Fixed submission:
while True:
	player_nun = int(input())
	if player_nun == 0:
		break
	
	#?????????????????????
	whole_data = []
	for i in range(0, player_nun):
		dat = input().split()
		p_data = []
		p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
		whole_data.append(p_data)
	
	#???????????????????????????????????????
	xel = {}
	for i in whole_data:
		for x in i[2:]:
			if x in xel:
				xel[x] += 1
			else:
				xel[x] = 1
	
	#??????????????????????????¢?????????
	score = {}
	for y in xel.keys():
		score[y] = player_nun + 1 - xel[y]	
	#????????¢??¨????????????????????????????????????
	result = []
	for i in whole_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
	
	#?????????????????????????¬?????????????????±???????	
	min_score = min(x[1] for x in result)
	winners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + sorted(winners)[0])
	
	#??£??????????????????????????????

Buggy python submission (verdict: Runtime Error):
while True:
	#player_nun = int(input())
	player_nun = 4
	if player_nun == 0:
		break
	
	#?????????????????????
	whole_data = []
	for i in (0, player_nun):
		#dat = input().split()
		#p_data = []
		#p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
			whole_data.append(p_data)
			
	#???????????????????????????????????????
	xel = {}
	for i in whole_data:
		for x in i[2:]:
			if x in xel:
				xel[x] += 1
			else:
				xel[x] = 1
	
	#??????????????????????????¢?????????
	score = {}
	for y in xel.keys():
		score[y] = 5 - xel[y]	
	#????????¢??¨????????????????????????????????????
	result = []
	for i in whole_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
	
	#?????????????????????????¬?????????????????±???????	
	min_score = min(x[1] for x in result)
	winners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + sorted(winners)[0])

Fixed submission:
while True:
	player_nun = int(input())
	if player_nun == 0:
		break
	
	#?????????????????????
	whole_data = []
	for i in range(0, player_nun):
		dat = input().split()
		p_data = []
		p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
		whole_data.append(p_data)
	
	#???????????????????????????????????????
	xel = {}
	for i in whole_data:
		for x in i[2:]:
			if x in xel:
				xel[x] += 1
			else:
				xel[x] = 1
	
	#??????????????????????????¢?????????
	score = {}
	for y in xel.keys():
		score[y] = player_nun + 1 - xel[y]	
	#????????¢??¨????????????????????????????????????
	result = []
	for i in whole_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
	
	#?????????????????????????¬?????????????????±???????	
	min_score = min(x[1] for x in result)
	winners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + sorted(winners)[0])
	
	#??£??????????????????????????????

Buggy python submission (verdict: Runtime Error):
while True:
	player_nun = int(input())
	player_nun = 4
	if player_nun == 0:
		break
	
	#?????????????????????
	whole_data = []
	for i in (0, player_nun):
		dat = input().split()
		p_data = []
		p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
			whole_data.append(p_data)
			
	#???????????????????????????????????????
	xel = {}
	for i in whole_data:
		for x in i[2:]:
			if x in xel:
				xel[x] += 1
			else:
				xel[x] = 1
	
	#??????????????????????????¢?????????
	score = {}
	for y in xel.keys():
		score[y] = 5 - xel[y]	
	#????????¢??¨????????????????????????????????????
	result = []
	for i in whole_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
	
	#?????????????????????????¬?????????????????±???????	
	min_score = min(x[1] for x in result)
	winners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + sorted(winners)[0])

Fixed submission:
while True:
	player_nun = int(input())
	if player_nun == 0:
		break
	
	#?????????????????????
	whole_data = []
	for i in range(0, player_nun):
		dat = input().split()
		p_data = []
		p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
		whole_data.append(p_data)
	
	#???????????????????????????????????????
	xel = {}
	for i in whole_data:
		for x in i[2:]:
			if x in xel:
				xel[x] += 1
			else:
				xel[x] = 1
	
	#??????????????????????????¢?????????
	score = {}
	for y in xel.keys():
		score[y] = player_nun + 1 - xel[y]	
	#????????¢??¨????????????????????????????????????
	result = []
	for i in whole_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
	
	#?????????????????????????¬?????????????????±???????	
	min_score = min(x[1] for x in result)
	winners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + sorted(winners)[0])
	
	#??£??????????????????????????????

Buggy python submission (verdict: Runtime Error):
while True:
	player_nun = int(input())
	player_nun = 4
	if player_nun == 0:
		break
	
	#?????????????????????
	whole_data = []
	for i in range(0, player_nun):
		dat = input().split()
		p_data = []
		p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
		whole_data.append(p_data)
	
	print(whole_data)
	#???????????????????????????????????????
	xel = {}
	for i in whole_data:
		for x in i[2:]:
			if x in xel:
				xel[x] += 1
			else:
				xel[x] = 1
	
	#??????????????????????????¢?????????
	score = {}
	for y in xel.keys():
		score[y] = 5 - xel[y]	
	#????????¢??¨????????????????????????????????????
	result = []
	for i in whole_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
	
	#?????????????????????????¬?????????????????±???????	
	min_score = min(x[1] for x in result)
	winners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + sorted(winners)[0])

Fixed submission:
while True:
	player_nun = int(input())
	if player_nun == 0:
		break
	
	#?????????????????????
	whole_data = []
	for i in range(0, player_nun):
		dat = input().split()
		p_data = []
		p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
		whole_data.append(p_data)
	
	#???????????????????????????????????????
	xel = {}
	for i in whole_data:
		for x in i[2:]:
			if x in xel:
				xel[x] += 1
			else:
				xel[x] = 1
	
	#??????????????????????????¢?????????
	score = {}
	for y in xel.keys():
		score[y] = player_nun + 1 - xel[y]	
	#????????¢??¨????????????????????????????????????
	result = []
	for i in whole_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
	
	#?????????????????????????¬?????????????????±???????	
	min_score = min(x[1] for x in result)
	winners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + sorted(winners)[0])
	
	#??£??????????????????????????????

Buggy python submission (verdict: Runtime Error):
while True:
	player_nun = int(input())
	player_nun = 4
	if player_nun == 0:
		break
	
	#?????????????????????
	whole_data = []
	for i in range(0, player_nun):
		dat = input().split()
		p_data = []
		p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
		whole_data.append(p_data)
	
	print(whole_data)
	#???????????????????????????????????????
	xel = {}
	for i in whole_data:
		for x in i[2:]:
			if x in xel:
				xel[x] += 1
			else:
				xel[x] = 1
	
	#??????????????????????????¢?????????
	score = {}
	for y in xel.keys():
		score[y] = 5 - xel[y]	
	#????????¢??¨????????????????????????????????????
	result = []
	for i in whole_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
	
	#?????????????????????????¬?????????????????±???????	
	min_score = min(x[1] for x in result)
	winners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + sorted(winners)[0])

Fixed submission:
while True:
	player_nun = int(input())
	if player_nun == 0:
		break
	
	#?????????????????????
	whole_data = []
	for i in range(0, player_nun):
		dat = input().split()
		p_data = []
		p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
		whole_data.append(p_data)
	
	#???????????????????????????????????????
	xel = {}
	for i in whole_data:
		for x in i[2:]:
			if x in xel:
				xel[x] += 1
			else:
				xel[x] = 1
	
	#??????????????????????????¢?????????
	score = {}
	for y in xel.keys():
		score[y] = player_nun + 1 - xel[y]	
	#????????¢??¨????????????????????????????????????
	result = []
	for i in whole_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
	
	#?????????????????????????¬?????????????????±???????	
	min_score = min(x[1] for x in result)
	winners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + sorted(winners)[0])
	
	#??£??????????????????????????????