import java.util.*;

public class TD3EX1Q1 {
  public static void main(String []args) {
    Stack<Integer> p1 = new Stack<Integer>();
    Stack<Integer> p2 = new Stack<Integer>();
    Scanner in = new Scanner(System.in);
    while (in.hasNext()) {
      p1.push(in.nextInt());
    }
    System.out.println("p1="+p1);
    
    /* BEGIN Solution */
    while (!p1.empty()) {
      p2.push(p1.pop());
    }
    /* END Solution */
    System.out.println("p2="+p2);
  }
}