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

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

d = A("d")
l = B("l")
a = B("a")
i = B("i")
b = B("b")
e = B("e")
h = B("h")

d.q = h
d.u = b
l.s = d
l.t = i
a.s = d
a.t = l
i.s = d
i.t = b
b.s = d
b.t = e
e.s = d
e.t = b
h.s = d
h.t = b
assert e.s.q.s.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: B = None
        self.txt = txt

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

d = A("d")
l = B("l")
a = B("a")
i = B("i")
b = B("b")
e = B("e")
h = B("h")

d.q = h
d.u = b
l.s = d
l.t = i
a.s = d
a.t = l
i.s = d
i.t = b
b.s = d
b.t = e
e.s = d
e.t = b
h.s = d
h.t = b
assert e.s.q.s.q.t.txt == "b"