public static void main(String[]  args){
		try{
			BufferedReader in;
            if (args.length > 0) {
                try {
                    in = new BufferedReader(new FileReader(args[0]));
                }
                catch (FileNotFoundException e) {
                    System.out.println("Kunne ikke �pne filen " + args[0]);
                    return;
                }
            }
            else {
                in = new BufferedReader(new InputStreamReader(System.in));
            }
			StringTokenizer st = new StringTokenizer(in.readLine());
			String[] ord = new String[st.countTokens()];
			int i=0, stop = 0;
			while(st.hasMoreTokens()) ord[i++]=st.nextToken();
			ArrayList<String> sord = new ArrayList<String>();
			String sokeord= in.readLine();
			Node rot = new Node();
			while(sokeord!=null){
				sokeord=sokeord.trim();
				sord.add(sokeord);
				build(sokeord, rot, sokeord.length(), 0);
				sokeord=in.readLine();
			}
			Node rotNode = bygg(ord, rot);
			for (String sok : sord) {
				returnList.clear();
				StringBuilder sbuf = new StringBuilder();
				sbuf.append(sok).append(":");
				posisjoner(sok, rotNode, sok.length(), 0);
				ArrayList<Integer> pos = returnList;
				stop = pos.size();
				int[] posi = new int[stop];
				for(i=0;i<stop;i++)posi[i]=pos.get(i).intValue();
				Arrays.sort(posi);
				for (i=0; i<stop; i++) {
					sbuf.append(" ").append(posi[i]);
				}
				System.out.println(sbuf.toString());
			}
		} catch(Exception e){
			System.out.println();
			e.printStackTrace();
		}
	}