import java.util.*; class Main { public static void main(String[] args){ Main T = new Main(); Scanner kb = new Scanner(System.in); int N = kb.nextInt(); Queue arr = new LinkedList(); for (int i = 1; i size){ k -= arr.size(); } for (int i = 1; i k){ bq.add(arr.poll()); }else{ System.out.println(arr.peek()); arr.poll(); } } bq.addAll(fq); arr = bq; } System.out.println(arr.poll()); } }