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

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

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

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

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

d = A("d")
k = B("k")
c = C("c")
l = D("l")
b = E("b")
e = C("e")
m = A("m")
a = E("a")

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

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

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

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

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

d = A("d")
k = B("k")
c = C("c")
l = D("l")
b = E("b")
e = C("e")
m = A("m")
a = E("a")

d.x = k
k.w = a
k.o = l
k.t = d
k.y = b
c.u = k
c.q = l
c.o = m
l.s = d
l.v = m
b.q = a
e.u = k
e.q = l
e.o = d
m.x = k
a.q = b
assert m.x.y.q.txt == "a"