Test case 1 is wrong

import java.util.*;
public class Main {

public static void main(String args[]) throws Exception {
	// Your Code Here
	Scanner sc = new Scanner(System.in);
	Queue<Integer> queue=new LinkedList<>();
	Queue<Integer> queue1=new LinkedList<>();
	queue1.offer(1);
     int n=sc.nextInt();
	 for(int i=0;i<n;i++)
	 {
       int x=sc.nextInt();
	   queue.offer(x);
	 }
     for(int i=1;i<n;i++)
	 {
		 int item=(int)queue.poll();
		 int item1=queue.peek();
		 if(item1>item)
		 {
			 queue1.offer(i+1);
		 }
		 else
		 {
			// queue.poll();
			// queue.(item);
		 queue1.offer(1);
		 }
	 }
	for(int i=0;i<n;i++)
	 {
	   System.out.print(queue1.poll()+" ");
	 } 
	 System.out.println("END");
}

}