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

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

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

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

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

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

b.w = e
b.s = g
g.t = e
e.x = d
e.w = g
l.s = g
l.q = g
d.y = g
d.u = g
d.q = b
a.w = e
a.s = g
assert e.x.q.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

b.w = e
b.s = g
g.t = e
e.x = d
e.w = g
l.s = g
l.q = g
d.y = g
d.u = g
d.q = b
a.w = e
a.s = g
assert e.x.q.w.x.txt == "d"