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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: A = None
        self.p: A = None
        self.s: D = None
        self.o: A = None
        self.q: F = None
        self.txt = txt

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

n.v = g
n.z = d
h.v = b
h.o = e
a.w = e
a.x = d
a.z = n
g.x = h
g.p = e
g.v = a
b.u = g
b.w = h
e.x = a
d.r = n
d.v = n
d.p = n
d.o = n
d.s = f
d.q = e
f.x = h
f.p = e
f.v = a
assert b.u.p.x.x.p.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: G = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: A = None
        self.p: A = None
        self.s: D = None
        self.o: A = None
        self.q: F = None
        self.txt = txt

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

n.v = g
n.z = d
h.v = b
h.o = e
a.w = e
a.x = d
a.z = n
g.x = h
g.p = e
g.v = a
b.u = g
b.w = h
e.x = a
d.r = n
d.v = n
d.p = n
d.o = n
d.s = f
d.q = e
f.x = h
f.p = e
f.v = a
assert b.u.p.x.x.p.z.o.txt == "n"