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

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

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

c = A("c")
f = B("f")
h = C("h")
d = B("d")
k = A("k")
e = C("e")

c.y = e
f.u = e
h.u = e
d.u = e
k.y = e
e.u = h
assert f.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

c = A("c")
f = B("f")
h = C("h")
d = B("d")
k = A("k")
e = C("e")

c.y = e
f.u = e
h.u = e
d.u = e
k.y = e
e.u = h
assert f.u.u.u.txt == "e"