i don't think my program is wrong

#include<stdio.h>
#include<string.h>
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,i,j,k,x,y;
        scanf("%d%d",&n,&k);
        char a[n][20];
        for(i=0;i<n;i++)
        {
            scanf("%s",a[i]);
        }
        char b[50][20];
        y=0;
        for(i=0;i<k;i++)
        {
            scanf("%d",&x);
            for(j=0;j<x;j++)
            {scanf("%s",b[y]);
            ++y;
            }
        }
        int flag=0;
        for(i=0;i<n;i++)
        {
            flag=0;
            for(j=0;j<y;j++)
            {
                if(strcmp(a[i],b[j])==0)
                {
                    flag=1;
                    break;
                }
            }
                if(flag==1)
                    printf("Yes ");
                    else
                    printf("No ");
        }
    }
return 0;
}

codechef ide is showing correct output but codechef is giving wrong answer