@@ -0,0 +1,1927 @@
+package com.javarush.task.task06.task0621;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0A%0A/* %0A%D0%A0%D0%BE%D0%B4%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D1%8B%D0%B5 %D1%81%D0%B2%D1%8F%D0%B7%D0%B8 %D0%BA%D0%BE%D1%88%D0%B5%D0%BA%0A*/%0A%0Apublic class Solution %7B%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));%0A%0A        Cat catGrandPa = new Cat(reader.readLine());%0A        Cat catGrandMa = new Cat(reader.readLine());%0A%0A        Cat catFather = new Cat(reader.readLine(), null, catGrandPa);%0A        Cat catMother = new Cat(reader.readLine(), catGrandMa, null);%0A%0A        Cat catSon = new Cat(reader.readLine(), catMother, catFather);%0A        Cat catDaughter = new Cat(reader.readLine(), catMother, catFather);%0A%0A        reader.close();%0A%0A        System.out.println(catGrandPa);%0A        System.out.println(catGrandMa);%0A        System.out.println(catFather);%0A        System.out.println(catMother);%0A        System.out.println(catSon);%0A        System.out.println(catDaughter);%0A    %7D%0A%0A    public static class Cat %7B%0A        private String name;%0A        private Cat mother;%0A        private Cat father;%0A%0A        Cat(String name) %7B%0A            this.name = name;%0A        %7D%0A%0A        Cat(String name, Cat mother, Cat father) %7B%0A            this.name = name;%0A            this.mother = mother;%0A            this.father = father;%0A        %7D%0A%0A        @Override%0A        public String toString() %7B%0A            if (mother == null && father == null)%0A                return %22Cat name is %22 + name + %22, no mother, no father%22;%0A            else if (mother == null)%0A                return %22Cat name is %22 + name + %22, no mother, father is %22 + father.name;%0A            else if (father == null)%0A                return %22Cat name is %22 + name + %22, mother is %22 + mother.name + %22, no father%22;%0A            else%0A                return %22Cat name is %22 + name + %22, mother is %22 + mother.name + %22, father is %22 + father.name;%0A        %7D%0A    %7D%0A%0A%7D%0A

Complete task0621