program rq021;
type
tree=record
ch:char;
num,p,l,r:longint;
end;
var
t:array [0..2049] of tree;
n,mi,i:longint;
s:string;
function two(i:longint):longint;
var
tt,f:longint;
begin
tt:=1;
for f:=1 to i do
tt:=tt*2;
two:=tt;
end;
procedure find(i:longint; s:string);
var
z,o:longint;
s1,s2:string;
begin
z:=pos(’0’,s);
o:=pos(’1’,s);
if (z>0)and(o=0) then t[i].ch:=’B’;
if (z=0)and(o>0) then t[i].ch:=’I’;
if (z>0)and(o>0) then t[i].ch:=’F’;
if length(s)>1 then begin
s1:=copy(s,1,length(s) div 2);
s2:=copy(s,length(s) div 2+1,length(s) div 2);
if t[i].l<>0 then find(t[i].l,s1);
if t[i].r<>0 then find(t[i].r,s2);
end;
write(t[i].ch);
end;
begin
readln(n);
readln(s);
mi:=two(n+1);
for i:=1 to mi do
begin
t[i].num:=i;
t[i].p:=i div 2;
if 2*i<mi then t[i].l:=2*i;
if 2*i+1<mi then t[i].r:=2*i+1;
end;
find(1,s);
readln; readln;
end.
var n,m,i,s:integer;
ch:char;
t:array[1..2000]of integer;
a:array[1..5000]of char;
procedure tree(s:integer);
var i:integer;
begin
if s>=m then
begin
write(a[s]);
exit;
end;
tree(s*2);
tree(s*2+1);
if (a[s*2]=’I’)and(a[s*2+1]=’I’) then a[s]:=’I’
else if (a[s*2]=’B’)and(a[s*2+1]=’B’) then a[s]:=’B’
else a[s]:=’F’;
write(a[s]);
end;
begin
readln(n);
m:=1;
for i:=1 to n do m:=m*2;
for i:=1 to m do
begin
read(ch);
if ch=’1’ then t[i]:=1 else t[i]:=0;
if t[i]=1 then a[m+i-1]:=’I’ else a[m+i-1]:=’B’;
end;
s:=1;
tree(s);
end.
var
s:ansistring;
n:integer;
procedure find(s:ansistring);
var
l:longint;
begin
l:=length(s);
if l=0
then exit;
find(copy(s,1,l div 2));
find(copy(s,l div 2+1,l div 2));
if pos(’1’,s)=0 then write(’B’);
if pos(’0’,s)=0 then write(’I’);
if (pos(’1’,s)<>0) and (pos(’0’,s)<>0)
then write(’F’);
end;
begin
readln(n);
read(s);
find(s);
end.
type arr=array[0..1024] of char;
var i,j,n:longint;
s:arr;
function judge(l,r:longint):char;
var i,j:longint;
begin
for i:=l+1 to r do
if s[i]<>s[l] then begin judge:=’F’; exit; end;
if s[l]=’0’ then judge:=’B’
else judge:=’I’;
end;
procedure work(l,r:longint;s:arr);
var i,j,k,t:longint;
begin
if r-l>0 then
begin work(l,(r+l)div 2,s); work((r+l)div 2+1,r,s); end;
write(judge(l,r));
end;
begin
readln(n); j:=1;
for i:=1 to n do j:=j*2;
for i:=1 to j do read(s[i]);
work(1,j,s);
end.
s:ansistring;
qq:char;
t,i,j,n:longint;
function try(r,l:longint):char;
var
t:longint;
t1,t2:char;
begin
if l-r=0 then
begin
try:=s[r];
write(try);
exit;
end;
t:=(r+l) div 2;
t1:=try(r,t);t2:=try(t+1,l);
if t1=t2 then try:=t1
else try:='F';
write(try);
end;
begin
readln(n);
readln(s);
t:=1;
for i:=1 to n do
t:=t*2;
n:=t;
for i:=1 to n do
if s[i]='0' then s[i]:='B'
else if s[i]='1' then s[i]:='I';
qq:=try(1,n);
end.