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

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

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

i = A("i")
f = B("f")
e = C("e")
j = B("j")

i.z = j
i.u = e
f.t = j
f.o = j
f.w = i
e.q = j
j.t = f
j.o = f
j.w = i
assert f.o.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: C = None
        self.txt = txt

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

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

i = A("i")
f = B("f")
e = C("e")
j = B("j")

i.z = j
i.u = e
f.t = j
f.o = j
f.w = i
e.q = j
j.t = f
j.o = f
j.w = i
assert f.o.o.w.txt == "i"