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

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

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

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

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

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

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

f = A("f")
k = B("k")
i = C("i")
e = D("e")
c = E("c")
g = F("g")
d = G("d")
m = E("m")
b = D("b")

f.z = i
f.s = k
f.v = k
f.p = d
k.r = i
k.w = i
k.x = e
k.o = m
k.v = g
i.r = f
i.v = c
i.z = b
i.t = g
e.z = g
e.v = g
e.q = k
c.o = i
g.p = k
d.r = f
m.o = i
b.z = g
b.v = g
b.q = k
assert m.o.z.q.w.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: B = None
        self.v: B = None
        self.p: G = None
        self.txt = txt

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

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

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

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

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

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

f = A("f")
k = B("k")
i = C("i")
e = D("e")
c = E("c")
g = F("g")
d = G("d")
m = E("m")
b = D("b")

f.z = i
f.s = k
f.v = k
f.p = d
k.r = i
k.w = i
k.x = e
k.o = m
k.v = g
i.r = f
i.v = c
i.z = b
i.t = g
e.z = g
e.v = g
e.q = k
c.o = i
g.p = k
d.r = f
m.o = i
b.z = g
b.v = g
b.q = k
assert m.o.z.q.w.z.v.txt == "g"