import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int num = scan.nextInt(); String hitsuji; String ga; int n; String hiki; for(int i = 0; i < num; i++){ hitsuji = scan.next(); ga = scan.next(); n = scan.nextInt(); hiki = scan.next(); System.out.println(hitsuji+" "+ga+" "+(n+1)+" "+hiki); } } }