@@ -0,0 +1,470 @@
+import java.util.Scanner;%0A%0Apublic class Main %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        Scanner sc = new Scanner(System.in);%0A%0A        int n = sc.nextInt();%0A%0A        for (int i = 0; i %3C n; i++) %7B%0A%0A            int stone = sc.nextInt();%0A            int player = sc.nextInt();%0A%0A            int winner = stone %25 player;%0A%0A            if (winner == 0) %7B%0A                winner = player;%0A            %7D%0A%0A            System.out.println(winner);%0A%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

Create : 0297