class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: A = None
        self.txt = txt

a = A("a")
h = B("h")
b = A("b")
l = B("l")
m = B("m")
i = B("i")
k = A("k")
c = A("c")
d = A("d")

a.q = i
a.o = d
h.x = m
h.t = c
b.q = m
b.o = a
l.x = i
l.t = d
m.x = i
m.t = a
i.x = l
i.t = k
k.q = l
k.o = b
c.q = i
c.o = b
d.q = m
d.o = b
assert c.o.o.q.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: A = None
        self.txt = txt

a = A("a")
h = B("h")
b = A("b")
l = B("l")
m = B("m")
i = B("i")
k = A("k")
c = A("c")
d = A("d")

a.q = i
a.o = d
h.x = m
h.t = c
b.q = m
b.o = a
l.x = i
l.t = d
m.x = i
m.t = a
i.x = l
i.t = k
k.q = l
k.o = b
c.q = i
c.o = b
d.q = m
d.o = b
assert c.o.o.q.t.q.txt == "l"