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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: E = None
        self.q: E = None
        self.txt = txt

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

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

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

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

e.v = a
d.y = g
d.s = k
d.q = m
a.v = d
j.p = d
j.z = n
k.z = j
k.q = d
k.p = d
k.r = e
k.x = m
g.v = a
c.z = j
c.q = d
c.p = d
c.r = n
c.x = m
f.y = n
f.s = m
f.q = k
n.v = a
m.z = j
m.q = d
m.p = d
m.r = e
m.x = c
assert g.v.v.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: E = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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