a=input().split()
e=[]
z=[]
e=[a[0],a[1]]
a=int(a[2])
x=0
for i in range(a):
a=input().split()
e.append(a)
print(e)
x1=int(e[0])
y1=int(e[1])
x2=int(e[2])
y2=int(e[3])
for i in x:
if x2-x1>0:
z.append("D")
x1=x2
y1=y2
y2=y2+2
x2=x2+2
elif x1-x2<0:
z.append("I")
x1=x2
y1=y2
y2=y2+2
x2=x2+2
if y2-y1<0:
z.append("B")
x1=x2
y1=y2
y2=y2+2
x2=x2+2
if y2-y1>0:
z.append("A")
x1=x2
y1=y2
y2=y2+2
x2=x2+2
else:
x1=x2
y1=y2
y2=y2+2
x2=x2+2
print(z)
e=[]
z=[]
e=[a[0],a[1]]
a=int(a[2])
x=0
for i in range(a):
a=input().split()
e.append(a)
print(e)
x1=int(e[0])
y1=int(e[1])
x2=int(e[2])
y2=int(e[3])
for i in x:
if x2-x1>0:
z.append("D")
x1=x2
y1=y2
y2=y2+2
x2=x2+2
elif x1-x2<0:
z.append("I")
x1=x2
y1=y2
y2=y2+2
x2=x2+2
if y2-y1<0:
z.append("B")
x1=x2
y1=y2
y2=y2+2
x2=x2+2
if y2-y1>0:
z.append("A")
x1=x2
y1=y2
y2=y2+2
x2=x2+2
else:
x1=x2
y1=y2
y2=y2+2
x2=x2+2
print(z)