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

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

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

j = A("j")
a = B("a")
l = C("l")
g = A("g")
f = A("f")
n = A("n")

j.z = a
a.r = l
a.s = l
a.u = g
l.z = f
l.w = f
l.o = a
g.z = a
f.z = a
n.z = a
assert a.u.z.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
l = C("l")
g = A("g")
f = A("f")
n = A("n")

j.z = a
a.r = l
a.s = l
a.u = g
l.z = f
l.w = f
l.o = a
g.z = a
f.z = a
n.z = a
assert a.u.z.r.w.txt == "f"