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

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

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

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

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

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

k.w = l
k.q = j
k.t = f
a.z = k
a.u = k
a.o = f
a.y = j
a.s = j
f.w = l
l.t = f
l.q = j
j.p = a
assert k.w.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: E = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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

k.w = l
k.q = j
k.t = f
a.z = k
a.u = k
a.o = f
a.y = j
a.s = j
f.w = l
l.t = f
l.q = j
j.p = a
assert k.w.t.w.txt == "l"