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

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

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

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

e.t = g
i.s = e
i.z = g
i.p = f
g.y = i
f.y = i
assert i.s.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

e.t = g
i.s = e
i.z = g
i.p = f
g.y = i
f.y = i
assert i.s.t.y.txt == "i"