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

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

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

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

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

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

a.z = n
e.r = f
e.t = f
e.w = a
e.x = a
l.s = a
l.o = h
l.t = f
n.p = l
n.y = a
n.q = a
n.r = b
f.r = l
f.x = e
b.p = l
b.y = a
b.q = a
b.r = h
h.p = l
h.y = a
h.q = a
h.r = n
assert b.p.o.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

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

a.z = n
e.r = f
e.t = f
e.w = a
e.x = a
l.s = a
l.o = h
l.t = f
n.p = l
n.y = a
n.q = a
n.r = b
f.r = l
f.x = e
b.p = l
b.y = a
b.q = a
b.r = h
h.p = l
h.y = a
h.q = a
h.r = n
assert b.p.o.r.p.txt == "l"