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

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

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

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

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

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

k.q = j
k.v = f
k.y = g
b.s = j
b.r = k
b.q = k
b.w = f
g.y = j
f.z = b
f.r = b
f.v = j
f.w = j
j.s = k
j.y = k
assert b.w.w.y.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: D = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

k.q = j
k.v = f
k.y = g
b.s = j
b.r = k
b.q = k
b.w = f
g.y = j
f.z = b
f.r = b
f.v = j
f.w = j
j.s = k
j.y = k
assert b.w.w.y.q.s.txt == "k"