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

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

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

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

i = A("i")
a = B("a")
k = C("k")
j = D("j")
f = B("f")
g = D("g")
c = A("c")
n = C("n")
m = D("m")

i.w = f
i.z = g
a.x = n
k.s = c
k.w = c
j.t = n
j.z = g
j.v = k
j.y = k
f.x = n
g.t = k
g.v = k
g.y = k
g.z = m
c.w = a
c.z = g
n.s = c
n.w = i
m.t = k
m.v = k
m.y = k
m.z = g
assert n.w.w.x.s.z.z.t.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: D = None
        self.txt = txt

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

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

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

i = A("i")
a = B("a")
k = C("k")
j = D("j")
f = B("f")
g = D("g")
c = A("c")
n = C("n")
m = D("m")

i.w = f
i.z = g
a.x = n
k.s = c
k.w = c
j.t = n
j.z = g
j.v = k
j.y = k
f.x = n
g.t = k
g.v = k
g.y = k
g.z = m
c.w = a
c.z = g
n.s = c
n.w = i
m.t = k
m.v = k
m.y = k
m.z = g
assert n.w.w.x.s.z.z.t.w.w.txt == "a"