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

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

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

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

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

b = A("b")
j = B("j")
m = C("m")
g = D("g")
e = E("e")

b.u = g
b.w = g
b.o = j
b.s = m
j.q = g
j.p = g
j.s = m
j.w = m
m.x = j
g.y = j
g.z = j
g.o = b
e.o = g
assert e.o.y.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: B = None
        self.s: C = None
        self.w: D = None
        self.txt = txt

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

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

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

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

b = A("b")
j = B("j")
m = C("m")
g = D("g")
e = E("e")

b.u = g
b.w = g
b.o = j
b.s = m
j.q = g
j.p = g
j.s = m
j.w = m
m.x = j
g.y = j
g.z = j
g.o = b
e.o = g
assert e.o.y.w.x.txt == "j"