//No.26 シャッフルゲーム import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.lang.Math.*; public class No26 { static final Scanner sc = new Scanner(System.in); static final PrintWriter out = new PrintWriter(System.out,false); static void solve() { int[] a = new int[3]; a[sc.nextInt()-1] = 1; int m = sc.nextInt(); for (int i=0; i