public class Driver {
    public static void main(String [] args) { 
         B b1 = null;
         b1 = new B(10,20);
         System.out.println(b1);

         b1 = new B();
         b1.m1(7,13);     
         System.out.println(b1);  

         b1 = new B();
         b1.m1(8);
         System.out.println(b1);  
    }
}

public class A {
    public int x;
    public int y;
    public A() { x = 1; y = 2; }
    public A(int x, int y) { 
         System.out.println("A(int,int)"); 
         this.x = x; 
         this.y = y; 
    }
    
   public void m1(int z) {
        System.out.println("A.m1(int)");
        x = ++z;
        y = z++;
   }

    public void m1(int x, int y) {
        System.out.println("A.m1(int,int)");
        x = y;
        this.y = x;
    }

    public String toString() {
        String s = "";
        s = s + x + " " + y;
        return(s);
    }
}

public class B extends A {
   public int x;
   public int z;

   public B() { 
       super(); 
       x = 2; 
       z = 1; 
   }

   public B(int x, int z) { 
       super(); 
       System.out.println("B(int,int)"); 
       this.x = x; 
       this.z = z; 
    }

   public void m1(int y) {
        System.out.println("B.m1(int)");
        x = z++;
        z = ++y;
   }

    public String toString() {
        String s = super.toString();;
        s = s + " " + x + " " + z;
        return(s);
    }
}
