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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: A = None
        self.u: B = None
        self.q: A = None
        self.t: B = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: B = None
        self.y: F = None
        self.z: E = None
        self.p: E = None
        self.u: D = None
        self.txt = txt

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

n.s = h
n.z = h
n.q = i
g.r = c
g.w = k
i.w = h
i.p = n
i.u = g
i.t = g
i.q = e
h.o = c
c.o = d
c.z = i
d.s = n
k.r = c
k.z = c
k.p = c
k.s = g
k.y = b
k.u = h
b.s = e
m.s = e
e.s = h
e.z = h
e.q = i
assert d.s.s.o.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: D = None
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: A = None
        self.u: B = None
        self.q: A = None
        self.t: B = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: B = None
        self.y: F = None
        self.z: E = None
        self.p: E = None
        self.u: D = None
        self.txt = txt

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

n.s = h
n.z = h
n.q = i
g.r = c
g.w = k
i.w = h
i.p = n
i.u = g
i.t = g
i.q = e
h.o = c
c.o = d
c.z = i
d.s = n
k.r = c
k.z = c
k.p = c
k.s = g
k.y = b
k.u = h
b.s = e
m.s = e
e.s = h
e.z = h
e.q = i
assert d.s.s.o.z.p.txt == "n"