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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: D = None
        self.txt = txt

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

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

c = A("c")
m = B("m")
l = C("l")
n = D("n")
k = E("k")

c.t = l
c.v = k
m.w = k
m.q = k
m.y = c
l.y = m
l.z = n
n.w = c
k.z = m
k.v = c
k.t = c
assert l.z.w.t.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: D = None
        self.txt = txt

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

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

c = A("c")
m = B("m")
l = C("l")
n = D("n")
k = E("k")

c.t = l
c.v = k
m.w = k
m.q = k
m.y = c
l.y = m
l.z = n
n.w = c
k.z = m
k.v = c
k.t = c
assert l.z.w.t.z.w.txt == "c"