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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.w: B = None
        self.q: E = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.w: B = None
        self.q: E = None
        self.y: E = None
        self.txt = txt

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

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

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

h.s = k
e.y = c
e.u = n
e.s = h
e.p = l
k.s = i
k.w = n
k.q = m
k.y = c
b.w = l
b.p = i
m.x = n
j.w = k
j.p = h
c.x = e
i.s = k
n.y = c
n.u = e
n.s = i
n.p = k
l.s = h
l.w = n
l.q = m
l.y = c
assert h.s.s.s.y.x.txt == "e"