import std.stdio, std.string;

void main() {
	uint[string] dictionary; // v[k], so string->uint
	foreach (line; stdin.byLine()) {
		// break sentence into words
		// Add each word in the sentence to the vocabulary
		foreach (word; splitter(strip(line))) {
			if (word in dictionary) continue; // nothing to do
			auto newId = dictionary.length;
			dictionary[word] = newId;
			writefln("%s\t%s", newId, word);
		}
	}
}
