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

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

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

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

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

i.w = e
i.x = k
k.r = a
k.t = a
e.w = g
e.z = a
e.v = k
g.v = e
n.w = g
n.z = a
n.v = k
a.v = n
m.w = e
m.x = k
f.w = e
f.x = k
assert n.v.t.v.v.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: B = None
        self.txt = txt

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

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

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

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

i.w = e
i.x = k
k.r = a
k.t = a
e.w = g
e.z = a
e.v = k
g.v = e
n.w = g
n.z = a
n.v = k
a.v = n
m.w = e
m.x = k
f.w = e
f.x = k
assert n.v.t.v.v.t.v.txt == "n"