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

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

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

j = A("j")
m = B("m")
l = C("l")
e = C("e")
n = B("n")

j.w = e
m.z = l
l.t = j
l.x = n
l.w = m
e.t = j
e.x = m
e.w = m
n.z = e
assert e.x.z.x.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

j = A("j")
m = B("m")
l = C("l")
e = C("e")
n = B("n")

j.w = e
m.z = l
l.t = j
l.x = n
l.w = m
e.t = j
e.x = m
e.w = m
n.z = e
assert e.x.z.x.z.t.txt == "j"