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

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

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

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

n = A("n")
e = B("e")
m = C("m")
a = D("a")
g = D("g")
f = C("f")
d = C("d")
l = D("l")
j = B("j")
i = B("i")

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

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

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

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

n = A("n")
e = B("e")
m = C("m")
a = D("a")
g = D("g")
f = C("f")
d = C("d")
l = D("l")
j = B("j")
i = B("i")

n.z = j
e.x = f
e.r = f
e.s = d
e.p = n
m.w = j
m.v = l
m.p = l
a.t = l
g.t = a
f.w = e
f.v = a
f.p = l
d.w = e
d.v = a
d.p = l
l.t = g
j.x = m
j.r = m
j.s = f
j.p = n
i.x = d
i.r = m
i.s = f
i.p = n
assert f.v.t.t.t.t.t.txt == "g"