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

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

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

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

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

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

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

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

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

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

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

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

g.p = b
g.x = e
b.o = e
b.v = n
b.z = a
k.u = g
k.s = b
k.y = n
n.x = h
l.x = m
l.s = n
l.v = b
e.o = b
e.v = n
e.z = a
h.u = g
h.s = e
h.y = n
a.p = e
a.x = e
d.u = g
d.s = e
d.y = n
m.x = l
m.s = n
m.v = b
assert d.s.z.p.z.x.z.x.z.txt == "a"