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

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

c = A("c")
d = B("d")
l = A("l")
i = B("i")
j = B("j")
b = A("b")
e = B("e")

c.t = d
c.z = b
d.r = j
d.w = c
l.t = d
l.z = b
i.r = e
i.w = b
j.r = d
j.w = b
b.t = e
b.z = l
e.r = i
e.w = l
assert l.z.t.w.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: A = None
        self.txt = txt

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

c = A("c")
d = B("d")
l = A("l")
i = B("i")
j = B("j")
b = A("b")
e = B("e")

c.t = d
c.z = b
d.r = j
d.w = c
l.t = d
l.z = b
i.r = e
i.w = b
j.r = d
j.w = b
b.t = e
b.z = l
e.r = i
e.w = l
assert l.z.t.w.z.z.z.txt == "b"