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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: B = None
        self.x: E = None
        self.p: A = None
        self.w: B = None
        self.txt = txt

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

l = A("l")
b = B("b")
i = C("i")
h = D("h")
f = E("f")
n = C("n")

l.z = b
b.x = f
b.p = h
i.x = h
i.y = n
i.o = n
i.z = b
i.u = f
h.o = l
h.p = l
h.q = b
h.w = b
h.x = f
f.o = i
f.r = l
n.x = h
n.y = i
n.o = i
n.z = b
n.u = f
assert l.z.x.o.x.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: B = None
        self.x: E = None
        self.p: A = None
        self.w: B = None
        self.txt = txt

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

l = A("l")
b = B("b")
i = C("i")
h = D("h")
f = E("f")
n = C("n")

l.z = b
b.x = f
b.p = h
i.x = h
i.y = n
i.o = n
i.z = b
i.u = f
h.o = l
h.p = l
h.q = b
h.w = b
h.x = f
f.o = i
f.r = l
n.x = h
n.y = i
n.o = i
n.z = b
n.u = f
assert l.z.x.o.x.w.p.txt == "h"