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

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

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

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

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

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

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

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

n.o = e
n.s = m
n.u = g
d.q = j
d.z = e
j.z = g
j.w = g
f.q = g
f.z = n
g.z = j
g.w = j
l.q = g
l.z = e
a.q = g
a.z = n
e.o = n
e.s = f
e.u = j
m.q = g
m.z = e
assert d.z.u.w.z.w.w.txt == "j"