const
mas : array [1..10] of string = ('dada', 'dadi', 'daum',
'dida', 'didi', 'dium',
'umda', 'umdi', 'umum', 'shsh');
procedure WriteOne(S1 : Integer; C1 : string; S2 : Integer; C2, M : string);
begin
writeln(s1, ' ', c1, ' ', s2, ' ', c2, ' ', m);
end;
procedure WriteAll(S1 : Integer; S2 : Integer; M : string; AllowSh : Boolean);
var
i : integer;
begin
for i := 1 to 9 do
begin
writeln(s1, ' ', mas[i], ' ', s2, ' ', mas[i], ' ', m);
end;
if allowSh then
writeln(s1, ' ', mas[10], ' ', s2, ' ', mas[10], ' ', m);
end;
begin
// umda
WriteOne(000, 'umda', 001, 'umda', 'um');
WriteOne(001, 'umda', 000, 'umda', 'da');
// umum
writeln('000 umum 001 umum um');
writeln('001 umum 002 umum um');
writeln('002 umum 600 umum da');
// dada
writeln('000 dada 000 dada da'); // 00 - is ok
// 102 - propusk 2
WriteAll(102, 101, 'da', false);
// 101 - propusk 1
WriteAll(101, 600, 'da', false);
// didi
writeln('000 didi 702 didi di');
// dida
writeln('000 dida 702 dida di');
// daum
writeln('000 daum 300 daum da');
// 300 - pause
WriteAll(300, 000, 'um', true);
// dadi
writeln('000 dadi 401 dadi da');
writeln('400 dadi 600 dadi da');
// 401 - nazad na 1
WriteAll(401, 400, 'di', true); // false - ok
// umdi
writeln('000 umdi 001 umdi um');
writeln('001 umdi 600 umdi da');
// dium
writeln('000 dium 300 daum da');
// Sostoyaniye da
/////////////////////////////////////////////////////////////////
writeln('600 dada 000 dada da');
writeln('600 dadi 000 dadi da');
writeln('600 daum 601 daum um');
writeln('600 dida 000 dida da');
writeln('600 didi 000 didi da');
writeln('600 dium 601 dium um');
writeln('600 umda 001 umda um');
writeln('600 umdi 001 umda um');
writeln('600 umum 001 umum um');
WriteAll(601, 600, 'da', false);
// Sostoyaniye 2 da
////////////////////////////////////////////////////////////////
WriteOne(700, 'dada', 000, 'dada', 'da'); // 000 - ok
WriteOne(700, 'dadi', 000, 'dadi', 'da');
WriteAll(702, 701, 'da', true);
WriteAll(701, 600, 'da', false); // damn!!
WriteOne(700, 'daum', 701, 'daum', 'um');
WriteOne(700, 'dida', 702, 'dida', 'di');
WriteOne(700, 'didi', 702, 'didi', 'di');
WriteOne(700, 'dium', 703, 'dium', 'di');
WriteAll(703, 702, 'um', true);
WriteOne(700, 'umda', 001, 'umda', 'um');
WriteOne(700, 'umdi', 001, 'umda', 'um');
WriteOne(700, 'umum', 001, 'umum', 'um');
end.
-