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

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

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

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

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

m = A("m")
j = B("j")
h = C("h")
l = D("l")
i = E("i")
c = D("c")
a = B("a")
g = C("g")
n = A("n")

m.p = a
m.s = a
m.o = i
m.y = l
j.v = g
h.s = j
h.x = l
l.t = g
l.x = n
l.z = c
l.o = c
l.p = c
i.t = a
c.t = g
c.x = n
c.z = l
c.o = l
c.p = l
a.v = h
g.s = j
g.x = l
n.p = a
n.s = a
n.o = i
n.y = l
assert j.v.s.v.s.v.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: B = None
        self.o: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

m = A("m")
j = B("j")
h = C("h")
l = D("l")
i = E("i")
c = D("c")
a = B("a")
g = C("g")
n = A("n")

m.p = a
m.s = a
m.o = i
m.y = l
j.v = g
h.s = j
h.x = l
l.t = g
l.x = n
l.z = c
l.o = c
l.p = c
i.t = a
c.t = g
c.x = n
c.z = l
c.o = l
c.p = l
a.v = h
g.s = j
g.x = l
n.p = a
n.s = a
n.o = i
n.y = l
assert j.v.s.v.s.v.s.v.txt == "g"