class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: C = None
        self.t: C = None
        self.z: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: A = None
        self.r: A = None
        self.t: A = None
        self.txt = txt

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

n = A("n")
e = B("e")
g = C("g")
b = D("b")
i = E("i")
a = F("a")
m = E("m")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: A = None
        self.r: A = None
        self.t: A = None
        self.txt = txt

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

n = A("n")
e = B("e")
g = C("g")
b = D("b")
i = E("i")
a = F("a")
m = E("m")

n.p = b
n.q = g
n.t = g
n.z = a
e.s = n
g.r = b
g.o = b
g.s = b
g.v = i
b.t = a
b.u = n
b.v = g
b.o = g
b.r = e
i.x = m
i.p = n
i.r = n
i.t = n
a.s = n
a.p = g
a.x = g
a.q = b
a.t = b
a.r = b
m.x = i
m.p = n
m.r = n
m.t = n
assert g.v.x.x.p.q.s.v.txt == "g"