/* classes with equality */

class A {
    int x;
    
    A (int x) { this.x = x; }
    boolean eq(A a) { 
	return this.x == a.x; 
    }
}

class B extends A {
    int y;

    B (int x, int y) { super(x); this.y = y; }
    // boolean eq(A a) { return false; }
    boolean eq(B b) {
	return super.eq(b) && this.y == b.y;
    }
}

class Eq {
    public static void main (String[] args) {
	A a1 = new A(1);
        B b1 = new B(1,2);
        if (a1.eq(b1)) System.out.println ("a1 = b1");
	else System.out.println ("NOT a1 = b1");
        if (b1.eq(a1))  System.out.println ("b1 = a1");
	else System.out.println ("NOT b1 = a1");
    }
}
