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

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

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

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

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

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

b.u = i
b.z = m
i.u = b
i.r = k
i.p = m
i.v = m
i.o = g
k.r = a
k.s = b
m.o = b
m.z = b
m.v = b
m.w = k
g.s = k
a.u = b
a.r = k
a.p = m
a.v = m
a.o = g
assert m.o.u.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

b.u = i
b.z = m
i.u = b
i.r = k
i.p = m
i.v = m
i.o = g
k.r = a
k.s = b
m.o = b
m.z = b
m.v = b
m.w = k
g.s = k
a.u = b
a.r = k
a.p = m
a.v = m
a.o = g
assert m.o.u.o.s.txt == "k"