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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: C = None
        self.txt = txt

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

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

a.s = g
a.t = g
c.y = h
c.p = h
m.x = k
m.o = c
m.p = h
m.v = g
k.r = g
k.o = m
e.w = a
e.t = k
e.r = k
e.x = n
n.x = k
n.o = c
n.p = h
n.v = e
g.w = a
g.t = k
g.r = k
g.x = n
h.y = c
h.p = c
assert a.s.r.o.v.x.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: C = None
        self.txt = txt

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

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

a.s = g
a.t = g
c.y = h
c.p = h
m.x = k
m.o = c
m.p = h
m.v = g
k.r = g
k.o = m
e.w = a
e.t = k
e.r = k
e.x = n
n.x = k
n.o = c
n.p = h
n.v = e
g.w = a
g.t = k
g.r = k
g.x = n
h.y = c
h.p = c
assert a.s.r.o.v.x.o.p.txt == "h"