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

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

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

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

i.z = h
c.w = i
h.o = j
h.t = j
h.p = c
j.w = i
assert j.w.z.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

i.z = h
c.w = i
h.o = j
h.t = j
h.p = c
j.w = i
assert j.w.z.p.w.txt == "i"