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

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

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

a = A("a")
e = B("e")
m = C("m")
d = A("d")

a.r = m
e.u = a
m.t = e
m.z = e
m.y = e
d.r = m
assert e.u.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

a = A("a")
e = B("e")
m = C("m")
d = A("d")

a.r = m
e.u = a
m.t = e
m.z = e
m.y = e
d.r = m
assert e.u.r.y.txt == "e"