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

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

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

m = A("m")
i = B("i")
c = C("c")
j = A("j")

m.s = i
m.y = c
m.w = j
i.z = j
c.u = j
c.t = j
c.x = j
j.s = i
j.y = c
j.w = m
assert c.u.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: C = None
        self.w: A = None
        self.txt = txt

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

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

m = A("m")
i = B("i")
c = C("c")
j = A("j")

m.s = i
m.y = c
m.w = j
i.z = j
c.u = j
c.t = j
c.x = j
j.s = i
j.y = c
j.w = m
assert c.u.s.z.txt == "j"