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

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

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

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

i = A("i")
n = B("n")
h = C("h")
c = D("c")
m = A("m")
d = D("d")
k = C("k")
f = D("f")
j = D("j")

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

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

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

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

i = A("i")
n = B("n")
h = C("h")
c = D("c")
m = A("m")
d = D("d")
k = C("k")
f = D("f")
j = D("j")

i.w = k
i.q = m
i.x = m
i.s = n
n.t = i
h.z = c
c.w = n
c.x = i
c.q = i
c.t = f
m.w = k
m.q = i
m.x = i
m.s = n
d.w = n
d.x = i
d.q = i
d.t = f
k.z = c
f.w = n
f.x = i
f.q = i
f.t = j
j.w = n
j.x = m
j.q = i
j.t = f
assert m.w.z.t.q.w.z.q.s.txt == "n"