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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: A = None
        self.r: A = None
        self.o: A = None
        self.txt = txt

m = A("m")
a = B("a")
d = C("d")
k = D("k")
g = E("g")

m.u = k
m.q = k
m.r = d
a.x = d
a.v = g
a.s = m
d.o = g
d.v = g
d.y = g
d.z = k
k.t = g
g.v = d
g.x = m
g.r = m
g.o = m
assert d.y.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: D = None
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: A = None
        self.r: A = None
        self.o: A = None
        self.txt = txt

m = A("m")
a = B("a")
d = C("d")
k = D("k")
g = E("g")

m.u = k
m.q = k
m.r = d
a.x = d
a.v = g
a.s = m
d.o = g
d.v = g
d.y = g
d.z = k
k.t = g
g.v = d
g.x = m
g.r = m
g.o = m
assert d.y.x.u.txt == "k"