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

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

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

b = A("b")
n = B("n")
a = C("a")
e = B("e")
j = C("j")

b.s = j
b.y = n
n.z = a
a.x = e
a.r = n
a.u = j
e.z = a
j.x = n
j.r = n
j.u = a
assert e.z.r.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: B = None
        self.txt = txt

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

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

b = A("b")
n = B("n")
a = C("a")
e = B("e")
j = C("j")

b.s = j
b.y = n
n.z = a
a.x = e
a.r = n
a.u = j
e.z = a
j.x = n
j.r = n
j.u = a
assert e.z.r.z.u.txt == "j"