// Arup Guha
// 7/18/2012
// Solution to BHCSI Contest Problem: ID Numbers

import java.util.*;
import java.io.*;

// Stores one student entry.
class student implements Comparable<student> {
	
	private String name;
	private int ID;
	
	public student(String n, int num) {
		name = n;
		ID = num;
	}
	
	// The problem spec prints out students like this.
	public String toString() {
		return name+" "+ID;
	}
	
	// We want students to be ordered alphabetically.
	public int compareTo(student other) {
		return name.compareTo(other.name);
	}
}

public class idnum {
	
	public final static int IDOFFSET = 11;
	
	public static void main(String[] args) throws Exception {
		
		Scanner fin = new Scanner(new File("idnum.in"));
		
		int numCases = fin.nextInt();
		
		// Go through each case.
		for (int loop=1; loop<=numCases; loop++) {
			
			// Set up storage for the camp.
			int numKids = fin.nextInt();
			int ID = fin.nextInt();
			student[] camp = new student[numKids];
			
			// Read in each kid, adjusting IDs as necessary.
			for (int i=0; i<numKids; i++) {
				String name = fin.next();
				camp[i] = new student(name, ID);
				ID += IDOFFSET;
			}
			
			// This gets them in order.
			Arrays.sort(camp);
			
			// Now just print.
			System.out.println("Summer camp #"+loop+":");
			for (int i=0; i<camp.length; i++)
				System.out.println(camp[i]);
			System.out.println();
		}
		
		fin.close();
	}
	
}