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

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

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

f = A("f")
m = B("m")
a = C("a")
l = A("l")
n = C("n")
k = A("k")
d = B("d")
c = A("c")
j = B("j")

f.w = n
f.z = j
m.x = l
a.w = m
a.s = m
a.r = c
l.w = n
l.z = j
n.w = m
n.s = d
n.r = k
k.w = n
k.z = j
d.x = f
c.w = n
c.z = j
j.x = k
assert n.r.z.x.w.r.z.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: B = None
        self.txt = txt

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

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

f = A("f")
m = B("m")
a = C("a")
l = A("l")
n = C("n")
k = A("k")
d = B("d")
c = A("c")
j = B("j")

f.w = n
f.z = j
m.x = l
a.w = m
a.s = m
a.r = c
l.w = n
l.z = j
n.w = m
n.s = d
n.r = k
k.w = n
k.z = j
d.x = f
c.w = n
c.z = j
j.x = k
assert n.r.z.x.w.r.z.x.w.txt == "n"