MULTHREE WA

this is my c code
I m getting WA
please help!!

int main() {
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int k,a,b,rem,last;
        scanf("%d %d %d",&k,&a,&b);
        if(k==2)
        {
            if((a+b)%3)
                printf("NO\n");
            else printf("YES\n");
        }
        rem=(k-3)%4;
        if(rem==1)
            rem=2;
        else if(rem==2)
            rem=4;
        else if(rem==3)
            rem=8;
        else rem=6;
        last=(rem*((a+b)%10))%10;
        if(last%3)
            printf("NO\n");
        else printf("YES\n");
    }
}

Your logic is completely wrong, either read the problem statement again or if you are not able to come out with the solution, refer to following link:
Editorial for Problems of Codechef-DSA-Learning-Series: 1-Complexity Analysis + Basics Warm Up.