/* This is R6.34
 * 
 */
import java.util.*; 

public class R634 {
  public static void main(String[] args) {
    ArrayList<Integer> a = new ArrayList<Integer>(); 
    a.add(1);
    a.add(4); 
    a.add(9);
    a.add(16);
    System.out.println( a ); 
    ArrayList<Integer> b = new ArrayList<Integer>(); 
    b.add(9);
    b.add(7); 
    b.add(4);
    b.add(9); 
    b.add(11);
    System.out.println( b ); 
    System.out.println( R634.same(a, b) ); // false
    System.out.println( R634.same(a, a) ); // true
    ArrayList<Integer> c = R634.copy(a); 
    System.out.println( c ); 
    System.out.println( R634.same(a, c) ); // true
    c.remove(0); 
    System.out.println( c ); 
    System.out.println( R634.same(a, c) ); // false
    R634.reset( c ); 
    System.out.println( c ); // [0, 0, 0]
    R634.empty( c ); 
    System.out.println( c ); // []
  }
  public static boolean same(ArrayList<Integer> u, ArrayList<Integer> v) {
    if (u == null && v == null) return true; 
    if (u != null && v != null) {
      if (u.size() != v.size()) return false; 
      for (int i = 0; i < u.size(); i++) {
        if (u.get(i) != v.get(i))
          return false;
      }
      return true;
    } else return false; 
  }
  public static ArrayList<Integer> copy(ArrayList<Integer> a) {
    ArrayList<Integer> result = new ArrayList<Integer>();  
    for (int e : a)
      result.add(e);
    return result; 
  }
  public static void reset(ArrayList<Integer> a) {
    for (int i = 0; i < a.size(); i++)
      a.set(i, 0); 
  }
  public static void empty(ArrayList<Integer> a) {
    while (a.size() > 0)
      a.remove(0); 
  }  
}