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

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

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

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

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

e = A("e")
b = B("b")
n = C("n")
g = D("g")
d = E("d")

e.s = g
b.t = e
b.u = n
b.w = n
n.q = d
n.x = g
n.o = g
g.u = n
d.v = g
d.z = g
d.t = b
d.y = b
assert e.s.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

e = A("e")
b = B("b")
n = C("n")
g = D("g")
d = E("d")

e.s = g
b.t = e
b.u = n
b.w = n
n.q = d
n.x = g
n.o = g
g.u = n
d.v = g
d.z = g
d.t = b
d.y = b
assert e.s.u.x.u.txt == "n"