#include <stdio.h>
char ans[1000],gus[1000];
int num[10];
int main()
{
int n,cnt=1;
while (scanf("%d",&n)==1&&n) {
printf("Game %d:
",cnt++);
for (int i=0;i<n;i++) {
scanf("%d",&ans[i]);
}
while (true) {
int A=0,B=0;
for (int i=0;i<n;i++) {
scanf("%d",&gus[i]);
if (ans[i]==gus[i])
A++;
}
if (gus[0]==0)
break;
for (int d=1;d<=9;d++) {
int c1=0,c2=0;
for (int i=0;i<n;i++) {
if (ans[i]==d)
c1++;
if (gus[i]==d)
c2++;
}
if (c1<c2)
B+=c1;
else
B+=c2;
}
B-=A;
printf(" (%d,%d)
",A,B);
}
}
return 0;
}