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

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

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

j = A("j")
m = B("m")
l = C("l")
a = B("a")

j.y = l
j.u = l
m.w = a
m.z = j
m.t = l
l.t = j
a.w = m
a.z = j
a.t = l
assert l.t.y.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: C = None
        self.txt = txt

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

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

j = A("j")
m = B("m")
l = C("l")
a = B("a")

j.y = l
j.u = l
m.w = a
m.z = j
m.t = l
l.t = j
a.w = m
a.z = j
a.t = l
assert l.t.y.t.u.txt == "l"