# Python3
infname, outfname = 'cities.txt', 'squeeze.txt'
with open(infname, 'r') as fin, open(outfname, 'w') as fout:
for line in fin.readlines():
city, population, area, country = line.split()
population, area = map(float, [population, area])
density = population / area
if density > 10000:
fout.write(' '.join(map(str, [city, density, country])) + '\n')