import java.util.Scanner;
import java.util.InputMismatchException;

public class NameAgeChecker {
   public static void main(String[] args) {
      Scanner scnr = new Scanner(System.in);

      String inputName;
      int age;
      
      inputName = scnr.next();
      while (!inputName.equals("-1")) {
         // FIXME: The following line will throw an InputMismatchException.
         //        Insert a try/catch statement to catch the exception.
         
         System.out.print(inputName + " ");
         try {
         age = scnr.nextInt();
         System.out.println(age + 1);
         }
         catch (Exception e) {
           System.out.println("0");
           scnr.nextLine();
         }
        inputName = scnr.next();
      }
   }
}