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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: A = None
        self.q: B = None
        self.r: A = None
        self.z: D = None
        self.txt = txt

f = A("f")
e = B("e")
m = C("m")
b = D("b")
l = E("l")
k = A("k")

f.u = e
f.w = e
f.q = l
f.p = l
f.x = k
e.v = k
e.t = b
m.z = b
b.v = k
b.y = e
l.v = m
l.u = f
l.r = f
l.q = e
l.z = b
k.u = e
k.w = e
k.q = l
k.p = l
k.x = f
assert m.z.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: E = None
        self.x: A = None
        self.p: E = None
        self.w: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: A = None
        self.q: B = None
        self.r: A = None
        self.z: D = None
        self.txt = txt

f = A("f")
e = B("e")
m = C("m")
b = D("b")
l = E("l")
k = A("k")

f.u = e
f.w = e
f.q = l
f.p = l
f.x = k
e.v = k
e.t = b
m.z = b
b.v = k
b.y = e
l.v = m
l.u = f
l.r = f
l.q = e
l.z = b
k.u = e
k.w = e
k.q = l
k.p = l
k.x = f
assert m.z.y.v.txt == "k"