class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: B = None
        self.s: D = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

m.o = e
m.x = h
m.r = h
m.s = l
h.z = i
a.z = m
l.r = k
l.x = h
k.v = a
k.t = e
e.z = a
e.v = a
e.q = m
e.r = i
e.u = i
n.o = e
i.z = h
assert n.o.q.x.z.txt == "i"