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

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

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

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

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

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

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

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

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

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

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

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

b.w = l
b.x = l
b.p = a
b.z = g
b.o = n
l.v = h
l.u = g
h.p = g
h.y = g
h.r = d
g.p = c
g.y = c
g.x = l
g.s = l
a.v = h
a.y = h
c.w = l
c.x = l
c.p = n
c.o = n
c.z = g
n.v = h
n.y = h
d.w = l
d.x = l
d.p = a
d.o = a
d.z = g
assert h.r.w.u.y.o.v.r.z.txt == "g"