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

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.o: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.x: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: C = None
        self.z: C = None
        self.y: A = None
        self.t: B = None
        self.v: C = None
        self.s: B = None
        self.txt = txt

e = A("e")
m = B("m")
g = C("g")
f = D("f")
h = E("h")
l = F("l")
n = G("n")
i = A("i")

e.v = n
e.x = h
e.t = g
e.y = m
m.v = n
m.o = n
g.o = n
g.x = e
f.q = l
h.w = g
l.z = f
l.r = m
n.q = i
n.w = g
n.z = g
n.v = g
n.y = e
n.t = m
n.s = m
i.v = n
i.x = h
i.t = g
i.y = m
assert f.q.z.q.z.q.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: G = None
        self.x: E = None
        self.t: C = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.o: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.x: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: C = None
        self.z: C = None
        self.y: A = None
        self.t: B = None
        self.v: C = None
        self.s: B = None
        self.txt = txt

e = A("e")
m = B("m")
g = C("g")
f = D("f")
h = E("h")
l = F("l")
n = G("n")
i = A("i")

e.v = n
e.x = h
e.t = g
e.y = m
m.v = n
m.o = n
g.o = n
g.x = e
f.q = l
h.w = g
l.z = f
l.r = m
n.q = i
n.w = g
n.z = g
n.v = g
n.y = e
n.t = m
n.s = m
i.v = n
i.x = h
i.t = g
i.y = m
assert f.q.z.q.z.q.r.o.txt == "n"