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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
f = C("f")
e = D("e")
d = E("d")
m = A("m")
g = C("g")
c = E("c")

k.u = f
k.o = e
j.r = c
j.o = m
j.v = e
j.p = e
f.w = j
e.u = m
e.r = m
e.w = d
d.z = e
d.v = g
m.u = f
m.o = e
g.w = j
c.z = e
c.v = g
assert m.o.w.z.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
f = C("f")
e = D("e")
d = E("d")
m = A("m")
g = C("g")
c = E("c")

k.u = f
k.o = e
j.r = c
j.o = m
j.v = e
j.p = e
f.w = j
e.u = m
e.r = m
e.w = d
d.z = e
d.v = g
m.u = f
m.o = e
g.w = j
c.z = e
c.v = g
assert m.o.w.z.w.v.txt == "g"