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

f = A("f")
e = B("e")
n = C("n")
j = B("j")
a = C("a")
d = B("d")

f.w = n
f.y = e
f.o = j
e.z = n
n.q = d
n.u = f
j.z = n
a.q = e
a.u = f
d.z = a
assert j.z.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: B = None
        self.o: 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.q: B = None
        self.u: A = None
        self.txt = txt

f = A("f")
e = B("e")
n = C("n")
j = B("j")
a = C("a")
d = B("d")

f.w = n
f.y = e
f.o = j
e.z = n
n.q = d
n.u = f
j.z = n
a.q = e
a.u = f
d.z = a
assert j.z.u.w.txt == "n"