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

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

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

e = A("e")
c = B("c")
a = C("a")
h = C("h")
i = B("i")

e.u = a
c.s = e
a.y = h
h.y = a
i.s = e
assert a.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

e = A("e")
c = B("c")
a = C("a")
h = C("h")
i = B("i")

e.u = a
c.s = e
a.y = h
h.y = a
i.s = e
assert a.y.y.y.y.txt == "a"