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

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

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

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

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

k = A("k")
c = B("c")
g = C("g")
h = D("h")
m = E("m")
e = D("e")

k.u = c
c.u = m
c.w = e
g.o = c
g.s = h
g.x = k
g.t = e
g.v = m
h.t = c
m.w = c
m.z = g
m.r = g
e.t = c
assert g.o.w.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

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

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

k = A("k")
c = B("c")
g = C("g")
h = D("h")
m = E("m")
e = D("e")

k.u = c
c.u = m
c.w = e
g.o = c
g.s = h
g.x = k
g.t = e
g.v = m
h.t = c
m.w = c
m.z = g
m.r = g
e.t = c
assert g.o.w.t.w.txt == "e"