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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

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

e.v = m
e.y = g
e.o = h
k.p = m
g.p = h
h.y = k
h.p = g
h.r = g
h.u = e
m.t = g
m.w = h
assert k.p.w.u.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: C = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

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

e.v = m
e.y = g
e.o = h
k.p = m
g.p = h
h.y = k
h.p = g
h.r = g
h.u = e
m.t = g
m.w = h
assert k.p.w.u.o.u.txt == "e"