uses crt;
type mast=(pik,tref,bub,cherv);
dost=(six,seven,eight,nine,ten,valet,dama,korol,tuz);
karta=record
m: mast;
d: dost;
end;
function b(k_1,k_2,k_3:karta):boolean;
begin
if (k_1.m=k_3.m) and (k_2.m<>k_1.m) then
b:=true
else begin
if (k_1.m=k_2.m) and (k_1.d>k_2.d) then
b:=true
else
b:=false;
end;
end;
var k_1,k_2,k_3: karta;
w,r,q,e,y:string;
n:boolean;
begin
clrscr;
write('vvedite mast karty 1:');
readln(q);
if q='pik' then k_1.m:=pik;
if q='tref' then k_1.m:=tref;
if q='cherv' then k_1.m:=cherv;
if q='bub' then k_1.m:=bub;
write('dostoinstvo 1:');
readln(w);
if w='6' then k_1.d:=six;
if w='7' then k_1.d:=seven;
if w='8' then k_1.d:=eight;
if w='9' then k_1.d:=nine;
if w='10' then k_1.d:=ten;
if w='valet' then k_1.d:=valet;
if w='dama' then k_1.d:=dama;
if w='korol' then k_1.d:=korol;
if w='tuz' then k_1.d:=tuz;
write('vvedite mast karty 2:');
readln(e);
if e='pik' then k_2.m:=pik;
if e='tref' then k_2.m:=tref;
if e='cherv' then k_2.m:=cherv;
if e='bub' then k_2.m:=bub;
write('dostoinstvo 2:');
readln(r);
if r='6' then k_2.d:=six;
if r='7' then k_2.d:=seven;
if r='8' then k_2.d:=eight;
if r='9' then k_2.d:=nine;
if r='10' then k_2.d:=ten;
if r='valet' then k_2.d:=valet;
if r='dama' then k_2.d:=dama;
if r='korol' then k_2.d:=korol;
if r='tuz' then k_2.d:=tuz;
write('vvedite kozyr:');
readln(y);
if y='pik' then k_3.m:=pik;
if y='tref' then k_3.m:=tref;
if y='cherv' then k_3.m:=cherv;
if y='bub' then k_3.m:=bub;
n:=b(k_1,k_2,k_3);
if n=true then
writeln('karta 1 bet kartu 2')
else
writeln('karta 1 ne bet kartu 2');
readln;
end.