#!/usr/bin/python

#Parse files test.txt and get the minimum and maximum range of o[0-9]


min_out = {}
max_out = {}
with open('test.txt') as file:
	for line in file:
		splitted = line.split(',')
		o = splitted[0]
		if o not in min_out:
			min_out[o] = int(splitted[1].rstrip())
		else:
			val = min_out[o]
			val2 = int(splitted[1].rstrip())
			new_val_min = min(val,val2)
			min_out[o] = new_val_min
		if o not in max_out:
			max_out[o]  = int(splitted[1].rstrip())
		else:
			val = max_out[o]
			val2 = int(splitted[1].rstrip())
                        new_val_max = max(val,val2)
			max_out[o] = new_val_max
				
print min_out
print max_out
for (k,v), (k2,v2) in zip(min_out.items(), max_out.items()):
	print k,v,v2
