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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: D = None
        self.p: A = None
        self.txt = txt

b = A("b")
e = B("e")
l = C("l")
m = D("m")
n = E("n")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: D = None
        self.p: A = None
        self.txt = txt

b = A("b")
e = B("e")
l = C("l")
m = D("m")
n = E("n")

b.o = e
e.y = l
e.q = m
l.t = b
l.u = n
l.o = e
l.z = m
m.x = l
n.r = m
n.t = m
n.p = b
assert b.o.q.x.u.p.txt == "b"