#!/usr/bin/python
#encoding:utf8
import argparse

def make_parser():
	desc = 'odwzorowania plWN -> SUMO, ktore maja przypisane tylko R'
	parser = argparse.ArgumentParser(description = desc)
	parser.add_argument('-i', '--in-file', dest = 'in_file', required = True)
	return parser
def read_file_as_dict(filename):
	lines = []
	lines_dict = {}

	with open(filename, 'rt') as fin:
		for line in fin:
			line = line.strip()
			if line.find('synset_str_plwn') != -1:
				continue
			line = line.split(';')
			line_id = "_".join([line[0],line[8]])
			lines_dict[line_id] = []
			lines_dict[line_id].append(line[-1])
	return lines_dict

def R_only_stats(lines_dict):
	stat = 0
	for key in lines_dict.keys():
		if 'R' in lines_dict[key] and not 'R' not in lines_dict[key]:
			print "%s;%s" %(key.split('_')[0],key.split('_')[1])
			stat +=1
	#print "R = %d" %(stat)

def main(argv = None):
	parser = make_parser()
	args = parser.parse_args()
	lines_dict = read_file_as_dict(args.in_file)

	R_only_stats(lines_dict)

if __name__ == '__main__':
	main()