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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: C = None
        self.z: E = None
        self.y: E = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: C = None
        self.z: E = None
        self.y: E = None
        self.o: C = None
        self.txt = txt

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

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

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

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

j.p = a
n.x = h
n.v = c
n.o = c
n.z = a
n.y = a
g.z = e
k.p = l
k.x = l
k.w = n
d.s = l
d.x = j
c.z = e
e.z = c
l.p = k
l.x = k
l.w = n
h.p = d
a.s = k
a.x = j
assert l.w.x.p.s.x.w.o.z.z.txt == "c"