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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

a = A("a")
c = B("c")
f = C("f")
g = D("g")
n = E("n")
l = C("l")
h = D("h")
d = C("d")

a.v = n
a.t = n
a.z = c
a.s = c
a.q = c
c.u = h
c.y = d
c.p = a
f.x = a
f.t = g
f.r = h
g.y = c
g.v = c
g.p = a
g.z = l
n.u = a
l.x = a
l.t = h
l.r = h
h.y = c
h.v = c
h.p = a
h.z = d
d.x = a
d.t = g
d.r = h
assert f.r.p.v.u.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: B = None
        self.s: B = None
        self.q: B = None
        self.t: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

a = A("a")
c = B("c")
f = C("f")
g = D("g")
n = E("n")
l = C("l")
h = D("h")
d = C("d")

a.v = n
a.t = n
a.z = c
a.s = c
a.q = c
c.u = h
c.y = d
c.p = a
f.x = a
f.t = g
f.r = h
g.y = c
g.v = c
g.p = a
g.z = l
n.u = a
l.x = a
l.t = h
l.r = h
h.y = c
h.v = c
h.p = a
h.z = d
d.x = a
d.t = g
d.r = h
assert f.r.p.v.u.v.u.txt == "a"