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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: G = None
        self.q: E = None
        self.v: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: F = None
        self.y: F = None
        self.x: F = None
        self.q: F = None
        self.t: A = None
        self.v: G = None
        self.txt = txt

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

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

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

b = A("b")
f = B("f")
m = C("m")
d = D("d")
n = E("n")
h = F("h")
a = G("a")
c = D("c")

b.v = d
f.x = d
f.p = d
f.r = h
m.r = n
m.q = n
m.p = a
m.v = f
d.r = m
d.p = h
d.y = h
d.x = h
d.q = h
d.t = b
d.v = a
n.t = m
h.r = n
h.z = n
h.x = n
h.o = c
h.t = f
a.o = m
a.x = m
a.q = h
a.p = h
a.v = h
c.r = m
c.p = h
c.y = h
c.x = h
c.q = h
c.t = b
c.v = a
assert m.p.o.v.p.v.q.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: G = None
        self.q: E = None
        self.v: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: F = None
        self.y: F = None
        self.x: F = None
        self.q: F = None
        self.t: A = None
        self.v: G = None
        self.txt = txt

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

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

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

b = A("b")
f = B("f")
m = C("m")
d = D("d")
n = E("n")
h = F("h")
a = G("a")
c = D("c")

b.v = d
f.x = d
f.p = d
f.r = h
m.r = n
m.q = n
m.p = a
m.v = f
d.r = m
d.p = h
d.y = h
d.x = h
d.q = h
d.t = b
d.v = a
n.t = m
h.r = n
h.z = n
h.x = n
h.o = c
h.t = f
a.o = m
a.x = m
a.q = h
a.p = h
a.v = h
c.r = m
c.p = h
c.y = h
c.x = h
c.q = h
c.t = b
c.v = a
assert m.p.o.v.p.v.q.z.t.txt == "m"