class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: E = None
        self.u: F = None
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: C = None
        self.o: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: E = None
        self.z: B = None
        self.r: B = None
        self.w: A = None
        self.txt = txt

i = A("i")
g = B("g")
m = C("m")
e = D("e")
k = E("k")
n = F("n")

i.t = m
i.q = k
i.u = n
i.o = n
g.r = m
g.t = m
g.o = m
m.u = e
m.x = n
e.v = k
e.z = k
e.q = m
e.x = n
k.q = e
n.v = m
n.x = k
n.z = g
n.r = g
n.w = i
assert m.u.v.q.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: E = None
        self.u: F = None
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: C = None
        self.o: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: E = None
        self.z: B = None
        self.r: B = None
        self.w: A = None
        self.txt = txt

i = A("i")
g = B("g")
m = C("m")
e = D("e")
k = E("k")
n = F("n")

i.t = m
i.q = k
i.u = n
i.o = n
g.r = m
g.t = m
g.o = m
m.u = e
m.x = n
e.v = k
e.z = k
e.q = m
e.x = n
k.q = e
n.v = m
n.x = k
n.z = g
n.r = g
n.w = i
assert m.u.v.q.v.q.txt == "e"