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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: D = None
        self.x: D = None
        self.t: A = None
        self.v: A = None
        self.txt = txt

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

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

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

f = A("f")
i = B("i")
n = C("n")
b = D("b")
k = E("k")

f.v = k
f.q = k
f.t = k
f.x = i
f.y = b
i.q = f
i.t = f
i.v = f
i.y = b
i.x = b
n.w = k
b.r = f
k.u = i
assert k.u.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: B = None
        self.q: E = None
        self.t: E = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: D = None
        self.x: D = None
        self.t: A = None
        self.v: A = None
        self.txt = txt

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

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

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

f = A("f")
i = B("i")
n = C("n")
b = D("b")
k = E("k")

f.v = k
f.q = k
f.t = k
f.x = i
f.y = b
i.q = f
i.t = f
i.v = f
i.y = b
i.x = b
n.w = k
b.r = f
k.u = i
assert k.u.t.q.txt == "k"