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

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

l = A("l")
c = B("c")
h = B("h")
b = A("b")
j = B("j")
k = A("k")
f = B("f")
e = B("e")

l.t = e
l.w = b
c.x = j
h.x = c
b.t = c
b.w = k
j.x = e
k.t = h
k.w = b
f.x = e
e.x = f
assert k.w.w.w.w.t.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: A = None
        self.txt = txt

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

l = A("l")
c = B("c")
h = B("h")
b = A("b")
j = B("j")
k = A("k")
f = B("f")
e = B("e")

l.t = e
l.w = b
c.x = j
h.x = c
b.t = c
b.w = k
j.x = e
k.t = h
k.w = b
f.x = e
e.x = f
assert k.w.w.w.w.t.x.x.txt == "j"