У меня все выводит по заданию... но сайт отказывает, ругается, что строчки вывода не правильно сформированы...
public class Solution {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        System.out.print("дедушка ");
        String grandfatherName = "дедушка " + reader.readLine();
        Cat catGrandfather = new Cat(grandfatherName);

        System.out.print("бабушка ");
        String grandmotherName = "бабушка " + reader.readLine();
        Cat catGrandmother = new Cat(grandmotherName);

        System.out.print("папа ");
        String fatherName = "папа " + reader.readLine();
        Cat catFather = new Cat(fatherName, catGrandfather, null);

        System.out.print("мама ");
        String motherName = "мама " + reader.readLine();
        Cat catMother = new Cat(motherName,null, catGrandmother);

        System.out.print("сын ");
        String sonName = "сын " + reader.readLine();
        Cat catSon = new Cat(sonName, catFather, catMother);

        System.out.print("дочь ");
        String daughterName = "дочь " + reader.readLine();
        Cat catDaughter = new Cat(daughterName, catFather, catMother);

        System.out.println(catGrandfather);
        System.out.println(catGrandmother);
        System.out.println(catFather);
        System.out.println(catMother);
        System.out.println(catSon);
        System.out.println(catDaughter);
    }

    public static class Cat {
        private String name;
        private Cat parentM;
        private Cat parentW;

        Cat(String name) {
            this.name = name;
        }

        Cat(String name, Cat parentM, Cat parentW) {
            this.name = name;
            this.parentM = parentM;
            this.parentW = parentW;
        }

        @Override
        public String toString() {
            String m,w;
            if (parentM == null) { m = "no father"; } else { m = "father is " + parentM.name; }
            if (parentW == null) { w = "no mother"; } else { w = "mother is " + parentW.name; }
            return "Cat name is " + name + ", " + w + ", " + m;

        }
    }

}
Пример отработки программы:
дедушка Вася
бабушка Мурка
папа Котофей
мама Василиса
сын Мурчик
дочь Пушинка
Cat name is дедушка Вася, no mother, no father
Cat name is бабушка Мурка, no mother, no father
Cat name is папа Котофей, no mother, father is дедушка Вася
Cat name is мама Василиса, mother is бабушка Мурка, no father
Cat name is сын Мурчик, mother is мама Василиса, father is папа Котофей
Cat name is дочь Пушинка, mother is мама Василиса, father is папа Котофей