class Animal {
    void speak() {
        System.out.println("동물이 소리를 냅니다.");
    }
}

class Dog extends Animal {
    @Override
    void speak() {
        System.out.println("멍멍");
    }
}

class Cat extends Animal {
    @Override
    void speak() {
        System.out.println("야옹");
    }
}

class Duck extends Animal {
    @Override
    void speak() {
        System.out.println("꽥꽥");
    }
}
public class AnimalTest {
    public static void print(Animal a) {
        a.speak();
    }

    public static void main(String arg[]) {
        Animal a1 = new Dog();
        Animal a2 = new Cat();
        Animal a3 = new Duck();

        print(a1);
        print(a2);
        print(a3);
    }
}