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

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

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

m = A("m")
i = B("i")
d = C("d")
n = C("n")
b = B("b")
f = A("f")
j = C("j")
h = B("h")
e = A("e")

m.u = f
m.w = e
i.z = b
i.r = n
d.s = i
d.q = j
n.s = b
n.q = d
b.z = i
b.r = d
f.u = e
f.w = m
j.s = i
j.q = d
h.z = b
h.r = d
e.u = f
e.w = m
assert n.q.s.r.s.r.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: A = None
        self.txt = txt

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

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

m = A("m")
i = B("i")
d = C("d")
n = C("n")
b = B("b")
f = A("f")
j = C("j")
h = B("h")
e = A("e")

m.u = f
m.w = e
i.z = b
i.r = n
d.s = i
d.q = j
n.s = b
n.q = d
b.z = i
b.r = d
f.u = e
f.w = m
j.s = i
j.q = d
h.z = b
h.r = d
e.u = f
e.w = m
assert n.q.s.r.s.r.s.r.txt == "n"