class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: B = None
        self.q: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

a = A("a")
f = B("f")
b = C("b")
j = D("j")
k = E("k")

a.x = f
a.w = f
a.q = f
a.z = j
f.q = j
f.p = j
f.t = j
f.o = k
f.z = k
b.s = j
b.r = j
b.o = j
j.s = f
j.w = b
j.z = k
j.p = k
j.o = a
k.z = j
assert k.z.w.o.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: B = None
        self.q: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

a = A("a")
f = B("f")
b = C("b")
j = D("j")
k = E("k")

a.x = f
a.w = f
a.q = f
a.z = j
f.q = j
f.p = j
f.t = j
f.o = k
f.z = k
b.s = j
b.r = j
b.o = j
j.s = f
j.w = b
j.z = k
j.p = k
j.o = a
k.z = j
assert k.z.w.o.w.r.txt == "j"