1 #include <iostream>
2 #include <cmath>
3 using namespace std;
4
5 int get_sg(int box, int sto)
6 {
7 int sqrtbox = (int)sqrt((double)box) + 1;
8 while(sqrtbox * sqrtbox + sqrtbox >= box)
9 sqrtbox--;
10 if(sqrtbox < sto)
11 return box - sto;
12 else
13 get_sg(sqrtbox, sto);
14 }
15
16 int main(void)
17 {
18 #ifndef ONLINE_JUDGE
19 freopen("in.txt", "r", stdin);
20 #endif
21 int n, cas_c = 1;
22 while(scanf("%d", &n), n)
23 {
24 int yihuo = 0;
25 for(int i = 0; i < n; i++)
26 {
27 get_sg(n, 0);
28 int box, sto;
29 scanf("%d %d", &box, &sto);
30 if(box != 0)
31 yihuo ^= get_sg(box, sto);
32 else
33 yihuo ^= 0;
34 }
35 printf("Case %d:\n", cas_c++);
36 if(!yihuo)
37 printf("No\n");
38 else
39 printf("Yes\n");
40 }
41 return 0;
42 }