import java.util.Scanner;
import java.util.Arrays;
public class Solution
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter list1 length: ");
int length1 = input.nextInt();
int[] list1 = new int[length1];
System.out.print("Enter list1: ");
for(int i = 0; i < length1; i++)
list1[i] = input.nextInt();
System.out.print("Enter list2 length: ");
int length2 = input.nextInt();
int[] list2 = new int[length1];
System.out.print("Enter list2: ");
for(int i = 0; i < length2; i++)
list2[i] = input.nextInt();
input.close();
if(equal(list1, list2))
System.out.println("Two lists are identical");
else
System.out.println("Two lists are not identical");
}
public static boolean equal(int[] list1, int[] list2)
{
Arrays.sort(list1);
Arrays.sort(list2);
return Arrays.equals(list1, list2);
}
}