Help me in solving AIRM problem

My issue

My code

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		int i,j,k,c,x,a;
	
		
		for(i=0;i<t;i++)
		{
		        a = sc.nextInt();
		        x=0;
		    	int[] arr = new int[a];
		        int[] arr1 = new int[a];
		    
		    for(j=0;j<a;j++){
		      arr[j] = sc.nextInt();
	    	}
		     for(j=0;j<a;j++){
		       arr1[j] = sc.nextInt();
		     }
		    
		    for(k=0;k<a;k++){
		        c=0;
		        for(j=0;j<a;j++){
		            if(arr[k]==arr[j] )
		            c++;
		            if(arr[k]==arr1[j] && j!=k)
		            c++;
		        }
		        if(c>=x){
		            x=c;
		        }
		        
		    } 
		    System.out.println(x);
		    
		}
	
	}
}

Problem Link: AIRM Problem - CodeChef