Number the successive segments of the boundary line between $A$ and $B$ (marked thickly in the picture) with the numbers $0,1,...,n$, starting at the bottom.
The matrix $A$ has an $n\times m$ block of zeros in the bottom left-hand corner.
Go to the list of words starting with: a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z