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

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

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

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

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

d = A("d")
k = B("k")
j = C("j")
h = D("h")
a = E("a")

d.p = h
d.o = h
d.q = a
d.z = j
d.u = k
k.o = a
k.w = j
k.v = j
j.w = a
j.q = a
j.x = h
j.r = k
h.o = a
h.r = a
h.w = j
h.u = d
a.r = h
assert h.w.r.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: E = None
        self.z: C = None
        self.u: B = None
        self.o: D = None
        self.txt = txt

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

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

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

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

d = A("d")
k = B("k")
j = C("j")
h = D("h")
a = E("a")

d.p = h
d.o = h
d.q = a
d.z = j
d.u = k
k.o = a
k.w = j
k.v = j
j.w = a
j.q = a
j.x = h
j.r = k
h.o = a
h.r = a
h.w = j
h.u = d
a.r = h
assert h.w.r.w.r.txt == "k"