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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: A = None
        self.w: E = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: A = None
        self.w: E = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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