Help on The Lead Game

my code is right in the compiler when i try an test it but when i send it as an answer it tells me i am wrong. Here is my code:

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

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

/* 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
	{
	    Scanner sc = new Scanner(System.in);
	    
		int n = sc.nextInt();
		int[] playerOne = new int[n];
		int[] playerTwo = new int[n];
		int lead = 0;
		int leader = 0;
		
		for(int x = 0; x < n; x++)
		{
		    playerOne[x] = sc.nextInt();
		    playerTwo[x] = sc.nextInt();
		    if(Math.abs(playerOne[x] - playerTwo[x]) > lead) {
		        lead = Math.abs(playerOne[x] - playerTwo[x]);
		        if(playerOne[x] > playerTwo[x])
		            leader = 1;
		        else if(playerTwo[x] > playerOne[x])
		            leader = 2;
		    }
		    
		}
		System.out.print(leader + " " + lead);
	}
}