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

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

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

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

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

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

l.o = h
l.s = m
m.q = h
m.z = f
m.t = f
m.u = f
f.w = l
h.w = b
h.t = m
b.s = h
b.r = f
assert f.w.s.q.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

l.o = h
l.s = m
m.q = h
m.z = f
m.t = f
m.u = f
f.w = l
h.w = b
h.t = m
b.s = h
b.r = f
assert f.w.s.q.w.r.txt == "f"