/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mispelling;
import java.util.Scanner;
/**
*
* @author roger
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner s=new Scanner(System.in);
Scanner u = s.useDelimiter("\n");
short x=u.nextShort();
char [] array=new char[20];
while(x>0)
{
String sq = u.next();
x--;
String sw=sq.substring(0, 1);
sq.getChars(2, sq.length(), array, 0);
int as=Integer.parseInt(sw);
//System.out.println(array[0]);
System.out.print(sw+" ");
for(int i=0;i {if(i+1==as)
{
i=i+1;
}
System.out.print(array[i]);
}
System.out.println();
for(int j=0;j {array[j]=0;
}
}
}
}