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

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

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

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

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

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

n.z = d
l.q = b
l.p = b
l.u = b
l.z = h
l.y = j
b.r = k
b.z = k
e.x = d
e.u = h
e.p = b
e.r = j
k.o = d
j.q = b
j.p = b
j.u = b
j.z = e
j.y = l
h.x = d
h.u = e
h.p = b
h.r = j
d.z = n
assert l.z.r.z.x.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

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

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

n.z = d
l.q = b
l.p = b
l.u = b
l.z = h
l.y = j
b.r = k
b.z = k
e.x = d
e.u = h
e.p = b
e.r = j
k.o = d
j.q = b
j.p = b
j.u = b
j.z = e
j.y = l
h.x = d
h.u = e
h.p = b
h.r = j
d.z = n
assert l.z.r.z.x.z.z.txt == "d"