import java.util.ArrayList; 

public class Two {
  public static void main(String[] args) {
    int n = Integer.parseInt(args[0]), 
        m = Integer.parseInt(args[1]); 
    ArrayList<ArrayList<Integer>> values = Two.createIt(n, m); 
    Two.fillIt(values); 
    Two.showIt(values); // this is the focus
  }
  public static ArrayList<ArrayList<Integer>> createIt(int n, int m) {
    ArrayList<ArrayList<Integer>> values = new ArrayList<ArrayList<Integer>>(); 
    for (int i = 0; i < n; i++) {
      ArrayList<Integer> row = new ArrayList<Integer>(); 
      for (int j = 0; j < m; j++) {
        row.add( 0 ); 
      }
      values.add(row); 
    }
    return values; 
  }
  public static void fillIt(ArrayList<ArrayList<Integer>> a) { 
    for (int i = 0; i < a.size(); i++) {
      for (int j = 0; j < a.get(i).size(); j++) {
        a.get(i).set(j, ( (int) (Math.random() * 100 - 50) )); 
      }
    }
  } 
  public static void showIt(ArrayList<ArrayList<Integer>> a) { // notice a change from [2] 
    for (int line = 0; line < a.size(); line += 1) {
      for (int column = 0; column < a.get(line).size(); column = column + 1) {
        System.out.printf( "%4d", a.get(line).get(column) ); 
      }
      System.out.println(); 
    }
  } 
}

/*

Welcome to DrJava.  Working directory is C:\Users\cogli\Desktop
> run Two 3 5
  -5  10  17  35  33
  41   1  43   4 -39
  10  16 -13 -40  34
> run Two 3 5
  36 -24 -25 -42  26
  12   3 -43 -47  23
   1 -26 -12  19  35
> run Two 7 6
  43  31  25  42  -8 -39
  35  18 -25 -24  -3 -45
 -26  -4  33 -48  42  12
  33  -9 -10 -17 -45  15
 -10 -26 -25 -39  37 -48
 -46 -36   0 -15 -22  -6
  47  -1  37   9 -32  17
> run Two 7 6
  25  18  -4  22  44  -7
  13 -39 -11  16  15  22
  -7  28   2 -13  37   0
  -7 -26   7 -29  23  42
 -45  20 -35 -19  -4  36
  -4 -12  -4  17 -31  -6
  17  -6  34  43  25 -47


 */