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

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: D = None
        self.q: D = None
        self.p: E = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: D = None
        self.q: D = None
        self.p: E = None
        self.s: A = None
        self.txt = txt

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

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

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

l.s = h
l.z = j
d.v = g
d.p = k
d.x = l
g.v = k
g.o = n
g.q = n
g.p = h
g.s = l
n.o = g
n.y = l
h.z = k
k.v = g
k.o = n
k.q = n
k.p = h
k.s = j
i.v = g
i.p = g
i.x = l
j.s = h
j.z = l
assert d.v.p.z.p.z.p.z.txt == "k"