import java.io.*;
import java.util.*;

class Concordance {
	Concordance(String filename) throws Exception {
		Scanner scanner = new Scanner(new FileInputStream(filename));

		int lineNum = 0;

		while (scanner.hasNextLine()) {
			lineNum++;
			String line = scanner.nextLine();
			Scanner lineScanner = new Scanner(line);

			int wordOnLine = 0;

			while (lineScanner.hasNext()) {
				wordOnLine++;
				String word = lineScanner.next();
				ArrayList<Location> locations =  map.get(word);
				
				if (locations == null) {
					locations = new ArrayList<Location>();
					map.put(word, locations);
				}
				locations.add(new Location(lineNum, wordOnLine));
			}
		}
	}

	public String toString() {
		String result = "";
		for (String word : map.keySet())
			result += word + ": " + map.get(word) + "\n";
		return result;
	}
			
	private Map<String, ArrayList<Location>> map = new TreeMap<String, ArrayList<Location>>();

	public static void main(String [] args) throws Exception {
		if (args.length != 1) {
			System.out.println("Usage: Concordance <filename>");
			System.exit(1);
		}
		Concordance concordance = new Concordance(args[0]);
		System.out.println(concordance);
	}
}

