#include<stdio.h>
#define MAX 10000
typedef struct{
    int edges[MAX][MAX];   
}graph;

int arugo(int N,int A,int B,int C,int D){
    int i;
    for(i=0;i<N;i++){
            ;
    }
}


int main(){
    int i,T,N,A,B,C,D;
    scanf("%d",&T);
    int ans[T];
    for(i=0;i<T;i++)ans[i] = 0;
    for(i=0;i<T;i++){
        scanf("%d %d %d %d %d",&N,&A,&B,&C,&D);
        //arugo(N,A,B,C,D);


        //ans[i] = ;
    }
    for(i=0;i<T;i++){
        printf("%d\n",ans[i]);
    }
    return 0;
}