#include <stdio.h>
int main(void) {
int T = 10;
setbuf(stdout, NULL);
for (int test_case = 1; test_case <= T; test_case++)
{
int n;
scanf("%d\n", &n);
int node[205] = { 0, };
for (int i = 1; i <= n; i++)
{
char op;
scanf("%*d %c", &op);
if ((n % 2 == 0 && (i<n / 2)) || (n % 2 == 1 && i <= (n - 1) / 2))
scanf(" %*d %*d\n");
else if (n % 2 == 0 && i == n / 2)
scanf(" %*d\n");
node[i] = op;
}
int check = 1;
if (n % 2 == 0)
{
for (int i = 1; i <= n / 2; i++)
{
if (node[i] == '+' || node[i] == '-' || node[i] == '*' || node[i] == '/')
{
}
else
{
printf("#%d 0\n", test_case);
check = 0;
break;
}
}
if (check == 0)
continue;
for (int i = (n / 2) + 1; i <= n; i++)
{
if (node[i]<'0' || node[i] >'9')
{
printf("#%d 0\n", test_case);
check = 0;
break;
}
}
if (check == 0)
continue;
printf("#%d 1\n", test_case);
}
else
{
for (int i = 1; i <= (n - 1) / 2; i++)
{
if (node[i] == '+' || node[i] == '-' || node[i] == '*' || node[i] == '/')
{
}
else
{
printf("#%d 0\n", test_case);
check = 0;
break;
}
}
if (check == 0)
continue;
for (int i = ((n - 1) / 2) + 1; i <= n; i++)
{
if (node[i]<'0' || node[i] >'9')
{
printf("#%d 0\n", test_case);
check = 0;
break;
}
}
if (check == 0)
continue;
printf("#%d 1\n", test_case);
}
}
return 0;
}