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

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

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

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

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

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

m.y = h
m.x = k
m.p = j
j.s = h
j.y = c
j.z = b
k.z = n
k.x = l
b.x = h
i.y = l
i.p = k
i.z = c
l.x = i
c.s = h
c.y = j
c.z = b
n.z = k
n.x = l
h.y = l
h.p = k
h.z = j
assert c.y.y.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: C = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

m.y = h
m.x = k
m.p = j
j.s = h
j.y = c
j.z = b
k.z = n
k.x = l
b.x = h
i.y = l
i.p = k
i.z = c
l.x = i
c.s = h
c.y = j
c.z = b
n.z = k
n.x = l
h.y = l
h.p = k
h.z = j
assert c.y.y.z.x.txt == "h"