<>;$_{$_}+=--$.*++$%for<>;print"$_{$_} $_"for sort keys%_