uses crt;
var a,b:array[1..100] of integer;
n,i,x,k:integer;
begin
write('Nhap n:');readln(n);
writeln('Nhap cac so day thu nhat:');
for i:=1 to n do
begin
write('a[',i,']:');readln(a[i]);
end;writeln;
writeln('Nhap cac so day thu hai:');
for i:=1 to n do
begin
write('b[',i,']:');readln(b[i]);
end;writeln;
write('Nhap x:');readln(x);
for i:=1 to n do
begin
if a[i]=x then inc(k);
if b[i]=x then inc(k);
end;
if k=0 then write('Khong co x') else
begin
writeln('Co ',k,' phan tu ',x);
writeln(x,' co o vi tri:');
for i := 1 to n do if a[i]=x then write('a[',i,'] ');writeln;
for i := 1 to n do if b[i]=x then write('b[',i,'] ');writeln;
end;
readln
end.