/*大水水一个*/
#include <stdio.h>
#include <string.h>
#define MAX 1010
int main()
{
int N, A, B, used_s[MAX],used_g[MAX], s[MAX], g[MAX], cout = 0, i, j;
while( scanf( "%d", &N ) && N )
{
for( i = 1; i <= N; i++ )
scanf( "%d", &s[i] );
printf( "Game %d:\n", ++cout );
while( 1 )
{
memset(used_g, 0, sizeof(used_g) );
memset(used_s, 0, sizeof(used_s) );
A = 0; B = 0;
for( i = 1; i <= N; i++ )
scanf( "%d", &g[i] );
if( g[1] == 0 )
break;
for( i = 1; i <= N; i++ )
if( g[i] == s[i] )
{
used_g[i] = 1;
used_s[i] = 1;
A++;
}
for( i = 1; i <= N; i++ )
for( j = 1; j <= N; j++ )
if( g[j] == s[i] && !used_s[i] && !used_g[j] )
{
B++;
used_g[j] = 1;
used_s[i] = 1;
}
printf( " (%d,%d)\n", A, B);
}
}
return 0;
}