#!/usr/bin/lua

maxnum = tonumber(arg[1]) or 40
max, min = 0, 0

lines = io.stdin:lines()
arrays = {}
for line in lines do
  -- split
	local tmps = {}
	for c in string.gmatch(line,'[^%s]+') do
		table.insert(tmps, c)
	end
	local num = tonumber(tmps[2])
	if #tmps == 2 and num then
		table.insert(arrays, {tmps[1], num})
		if max < num then max = num end
		if min > num then min = num end
	end
end

for k,v in pairs(arrays) do
	local num = math.floor(maxnum * v[2] / max)
	print( string.format('%s\t%s\t%s', v[1], v[2], string.rep('*', num) ) )
end