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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: E = None
        self.txt = txt

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

g.u = l
g.v = i
g.q = d
g.t = e
l.q = b
l.x = i
l.y = e
l.u = g
l.o = d
d.x = l
d.q = b
i.w = d
i.r = l
i.u = l
i.o = e
b.r = g
b.t = e
e.r = g
e.t = b
assert d.x.x.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: D = None
        self.q: C = None
        self.t: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: E = None
        self.txt = txt

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

g.u = l
g.v = i
g.q = d
g.t = e
l.q = b
l.x = i
l.y = e
l.u = g
l.o = d
d.x = l
d.q = b
i.w = d
i.r = l
i.u = l
i.o = e
b.r = g
b.t = e
e.r = g
e.t = b
assert d.x.x.w.x.txt == "l"