Var
s,fam,nam:string;
begin
writeln('Vvedite imy i familiy:');
readln(s);
nam:=copy(s,1,pos(' ',s)-1);
fam:=copy(s,pos(' ',s)+1,length(s));
if nam[length(nam)]=fam[length(fam)-1] then writeln('Sovpadayut') else writeln('Ne sovpadayut');
write('Dly vyhoda nagmite Enter');
readln;
end.