import java.util.*;

class x {
  static long start = System.currentTimeMillis();

  static void timeStamp() {
    System.out.format("time = %.2f\n", (System.currentTimeMillis() - start) * 1e-3);
    start = System.currentTimeMillis();
  }

  public static void main( String[] args ) {
    final int N = (int)1e7;

    Queue<Integer> q = new  LinkedList<Integer>();
    for (int i = 0; i < N; i++) {
      q.offer(i);
      q.poll();
    }
    timeStamp();

    for (int i = 0; i < N; i++) {
      q.offer(i);
    }
    for (int i = 0; i < N; i++) {
      q.poll();
    }
    timeStamp();
  }
}