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

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

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

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

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

b = A("b")
m = B("m")
h = C("h")
k = D("k")
n = E("n")

b.r = m
b.o = m
b.t = k
b.x = h
m.x = k
h.z = b
h.x = b
h.t = k
h.o = m
h.s = n
k.u = n
k.q = b
k.p = b
n.s = m
assert k.u.s.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: B = None
        self.t: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

b = A("b")
m = B("m")
h = C("h")
k = D("k")
n = E("n")

b.r = m
b.o = m
b.t = k
b.x = h
m.x = k
h.z = b
h.x = b
h.t = k
h.o = m
h.s = n
k.u = n
k.q = b
k.p = b
n.s = m
assert k.u.s.x.q.txt == "b"