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

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

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

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

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

m = A("m")
j = B("j")
k = C("k")
b = D("b")
a = E("a")
i = E("i")
d = B("d")

m.v = i
m.u = j
m.q = d
j.o = b
j.t = k
k.r = m
k.x = m
k.v = b
k.z = a
b.q = j
b.o = m
b.x = d
a.t = b
i.t = b
d.o = b
d.t = k
assert d.o.o.u.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

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

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

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

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

m = A("m")
j = B("j")
k = C("k")
b = D("b")
a = E("a")
i = E("i")
d = B("d")

m.v = i
m.u = j
m.q = d
j.o = b
j.t = k
k.r = m
k.x = m
k.v = b
k.z = a
b.q = j
b.o = m
b.x = d
a.t = b
i.t = b
d.o = b
d.t = k
assert d.o.o.u.o.q.txt == "j"