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

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

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

i = A("i")
n = B("n")
a = C("a")
e = B("e")

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

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

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

i = A("i")
n = B("n")
a = C("a")
e = B("e")

i.t = a
i.y = a
n.z = e
n.y = e
n.t = a
a.p = i
e.z = n
e.y = n
e.t = a
assert a.p.t.p.txt == "i"