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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: C = None
        self.txt = txt

i = A("i")
a = B("a")
m = C("m")
n = D("n")
l = E("l")
e = F("e")

i.v = e
i.r = n
a.s = i
a.u = i
a.z = n
a.w = n
m.q = i
m.r = i
n.q = m
n.x = m
n.z = a
n.r = i
l.v = m
e.x = m
e.v = m
assert i.v.v.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.r: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: C = None
        self.txt = txt

i = A("i")
a = B("a")
m = C("m")
n = D("n")
l = E("l")
e = F("e")

i.v = e
i.r = n
a.s = i
a.u = i
a.z = n
a.w = n
m.q = i
m.r = i
n.q = m
n.x = m
n.z = a
n.r = i
l.v = m
e.x = m
e.v = m
assert i.v.v.r.v.txt == "e"