mother("Kate","Anna").
mother("Kate","Jon").
father("Vlad","Anna").
father("Vlad","Jon").
mother("Anna","Viktor").
mother("Anna","Elena").
mother("Anna","Nady").
father("Bob","Viktor").
father("Bob","Elena").
father("Bob","Nady").
father("Bob","Tan").
father("Bob","Kirill").
mother("Sue","Tan").
mother("Sue","Kirill").
mother("Elena","Adam").
father("Karl","Adam").
mother("Alex","Sofa").
mother("Alex","Robert").
mother("Alex","Stas").
father("Jon","Sofa").
father("Jon","Robert").
father("Jon","Stas").
father("Robert","Svetl").
mother("Yula","Svetl").
father("Robert","Zahar").
mother("Yula","Zahar").
mother("Sofa","Serg").
mother("Sofa","Olga").
father("Dmitry","Serg").
father("Dmitry","Olga").
mother("Sofa","Mary").
father("Grig","Mary").
male("Vlad").
male("Jon").
male("Robert").
male("Viktor").
male("Bob").
male("Karl").
male("Adam").
male("Grig").
male("Zahar").
male("Stas").
male("Kirill").
male("Serg").
male("Dmitry").
sd(X,Y):-mother(Y,X);father(Y,X).
mg(X,Y):-mother(X,Z),father(Y,Z);mother(Y,Z),father(X,Z).
bs(X,Y):-mother(Z1,X),father(Z2,X),mother(Z1,Y),father(Z2,Y),X\=Y.
kz(X,Y):-sd(X,Z1),sd(Y,Z2),bs(Z1,Z2).
dt(X,Y):-sd(Y,Z),bs(X,Z).
plem(X,Y):-dt(Y,X).
vn(X,Y):-sd(X,Z),sd(Z,Y).
db(X,Y):-vn(Y,X).
pvn(X,Y):-vn(X,Z),sd(Z,Y).
pdb(X,Y):-pvn(Y,X).
tstth(X,Y):-male(Y),mg(Y,Z),sd(Z,X).
svsvkr(X,Y):-mg(Y,Z),sd(Z,X),not(male(Y)).
ztnev(X,Y):-mg(X,Z),sd(Z,Y).
shsvy(X,Y):-mg(Y,Z),not(male(Z)),bs(Z,X).
devzol(X,Y):-mg(Y,Z),male(Z),bs(X,Z).
mchotch(X,Y):-sd(Y,Z),mg(X,Z),not(sd(Y,X)).
padpas(X,Y):-mchotch(Y,X).
svbs(X,Y):-padpas(X,Z1),sd(Y,Z1),X\=Y.
edkrbs(X,Y):-mch(Z,X),mother(Z,Y),X\=Y.
edutrbs(X,Y):-otch(Z,X),father(Z,Y),X\=Y.
sun(X,Y):-sd(X,Y),male(X).
douter(X,Y):-sd(X,Y),not(male(X)).
wife(X,Y):-mg(X,Y),not(male(X)).
husband(X,Y):-mg(X,Y),male(X).
brat(X,Y):-bs(X,Y),male(X).
sister(X,Y):-bs(X,Y),not(male(X)).
dvsister(X,Y):-kz(X,Y),not(male(X)).
dvbrat(X,Y):-kz(X,Y),male(X).
dada(X,Y):-dt(X,Y),male(X).
tota(X,Y):-dt(X,Y),not(male(X)).
plemca(X,Y):-plem(X,Y),not(male(X)).
plemk(X,Y):-plem(X,Y),male(X).
vnck(X,Y):-vn(X,Y),not(male(X)).
vnk(X,Y):-vn(X,Y),male(X).
bab(X,Y):-db(X,Y),not(male(X)).
ded(X,Y):-db(X,Y),male(X).
pvnca(X,Y):-pvn(X,Y),not(male(X)).
pvnk(X,Y):-pvn(X,Y),male(X).
pbab(X,Y):-pdb(X,Y),not(male(X)).
pded(X,Y):-pdb(X,Y),male(X).
th(X,Y):-tstth(X,Y),not(male(X)).
tst(X,Y):-tstth(X,Y),male(X).
svkr(X,Y):-svsvkr(X,Y),not(male(X)).
sv(X,Y):-svsvkr(X,Y),male(X).
nev(X,Y):-ztnev(X,Y),not(male(X)).
zt(X,Y):-ztnev(X,Y),male(X).
svy(X,Y):-shsvy(X,Y),not(male(X)).
sh(X,Y):-shsvy(X,Y),male(X).
zol(X,Y):-devzol(X,Y),not(male(X)).
dev(X,Y):-devzol(X,Y),male(X).
mch(X,Y):-mchotch(X,Y),not(male(X)).
otch(X,Y):-mchotch(X,Y),male(X).
pad(X,Y):-padpas(X,Y),not(male(X)).
pas(X,Y):-padpas(X,Y),male(X).
svsis(X,Y):-svbs(X,Y),not(male(X)).
svbr(X,Y):-svbs(X,Y),male(X).
edkrsis(X,Y):-edkrbs(X,Y),not(male(X)).
edkrbr(X,Y):-edkrbs(X,Y),male(X).
edutrsis(X,Y):-edutrbs(X,Y),not(male(X)).
edutrbr(X,Y):-edutrbs(X,Y),male(X).