class A:
    def __init__(self, txt: str):
        self.z: 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.y: A = None
        self.u: B = None
        self.txt = txt

g = A("g")
h = B("h")
e = C("e")

g.z = e
h.u = e
e.y = g
e.u = h
assert g.z.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: 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.y: A = None
        self.u: B = None
        self.txt = txt

g = A("g")
h = B("h")
e = C("e")

g.z = e
h.u = e
e.y = g
e.u = h
assert g.z.u.u.txt == "e"