package com.javarush.task.task06.task0621;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Родственные связи кошек
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String grandpaName = reader.readLine();
Cat catGrandpa = new Cat(grandpaName);
String grandmaName = reader.readLine();
Cat catGrandma = new Cat(grandmaName);
String fatherName = reader.readLine();
Cat catFather = new Cat(fatherName,grandpaName);
String motherName = reader.readLine();
Cat catMother = new Cat(motherName, grandmaName, null);
String sonName = reader.readLine();
Cat catSon = new Cat(sonName, motherName, fatherName);
String daughterName = reader.readLine();
Cat catDaughter = new Cat(daughterName, motherName, fatherName);
System.out.println(catGrandpa);
System.out.println(catGrandma);
System.out.println(catFather);
System.out.println(catMother);
System.out.println(catSon);
System.out.println(catDaughter);
}
public static class Cat {
private String name;
private String parentFather;
private String parentMother;
Cat(String name) {
this.name = name;
}
Cat(String name, String parentFather) {
this.name = name;
this.parentFather = parentFather;
}
Cat(String name, String parentMother, String parentFather) {
this.name = name;
this.parentMother = parentMother;
this.parentFather = parentFather;
}
@Override
public String toString() {
if (parentMother == null && parentMother == null){
return "The cat's name is " + name + ", no mother, no father ";}
else if (parentMother != null && parentFather == null){
return "The cat's name is " + name + ", mother is " + parentMother + ", no father";}
else if (parentFather != null && parentMother == null){
return "The cat's name is " + name + ", no mother, father is " + parentFather;}
else {
return "The cat's name is " + name + ", mother is " + parentMother + ", father is " + parentFather;
}
}
}
}