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

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

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

c = A("c")
a = B("a")
m = C("m")
k = C("k")
n = B("n")
g = B("g")
j = B("j")
h = C("h")
l = A("l")

c.w = j
a.q = j
a.w = l
m.y = k
m.r = a
m.z = a
k.y = h
k.r = n
k.z = g
n.q = a
n.w = c
g.q = n
g.w = l
j.q = n
j.w = c
h.y = m
h.r = a
h.z = n
l.w = a
assert n.w.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

c = A("c")
a = B("a")
m = C("m")
k = C("k")
n = B("n")
g = B("g")
j = B("j")
h = C("h")
l = A("l")

c.w = j
a.q = j
a.w = l
m.y = k
m.r = a
m.z = a
k.y = h
k.r = n
k.z = g
n.q = a
n.w = c
g.q = n
g.w = l
j.q = n
j.w = c
h.y = m
h.r = a
h.z = n
l.w = a
assert n.w.w.q.txt == "n"