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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: E = None
        self.y: C = None
        self.txt = txt

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

g = A("g")
d = B("d")
j = C("j")
n = D("n")
a = E("a")
e = D("e")
m = B("m")
c = A("c")

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: E = None
        self.y: C = None
        self.txt = txt

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

g = A("g")
d = B("d")
j = C("j")
n = D("n")
a = E("a")
e = D("e")
m = B("m")
c = A("c")

g.q = m
g.p = e
g.z = n
d.v = e
j.v = c
n.s = m
n.w = a
n.y = j
a.v = j
a.t = d
a.x = e
e.s = m
e.w = a
e.y = j
m.v = e
c.q = d
c.p = e
c.z = e
assert n.s.v.s.v.s.txt == "m"