memo1.Lines.Add ('SELECT filial, strana, Gorod FROM R1 WHERE filial not in (select distinct Filial from'+
'(SELECT R3.N_dog, R3.Filial, R1.Strana, R1.Gorod, R3.Data_n, R3.Data_o, R2.Klient, R2.Strana'+
'FROM (R2 INNER JOIN R3 ON R2.N_dog = R3.N_dog) INNER JOIN R1 ON R3.Filial = R1.Filial)'+'q where q.r1.Strana<>q.r2.Strana)');