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

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

class C:
    def __init__(self, txt: str):
        self.u: H = None
        self.z: A = None
        self.w: B = None
        self.y: A = None
        self.q: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: H = None
        self.p: F = None
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: C = None
        self.t: C = None
        self.z: D = None
        self.v: D = None
        self.u: A = None
        self.q: E = None
        self.x: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

n.u = k
k.o = f
m.u = c
m.z = n
m.y = n
m.w = k
m.q = d
f.z = a
g.s = c
g.p = b
g.y = f
b.w = d
b.s = m
b.t = m
b.z = f
b.v = f
b.u = n
b.q = g
b.x = c
d.t = n
c.p = g
a.s = c
a.p = b
a.y = f
assert f.z.s.p.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: H = None
        self.z: A = None
        self.w: B = None
        self.y: A = None
        self.q: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: H = None
        self.p: F = None
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: C = None
        self.t: C = None
        self.z: D = None
        self.v: D = None
        self.u: A = None
        self.q: E = None
        self.x: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

n.u = k
k.o = f
m.u = c
m.z = n
m.y = n
m.w = k
m.q = d
f.z = a
g.s = c
g.p = b
g.y = f
b.w = d
b.s = m
b.t = m
b.z = f
b.v = f
b.u = n
b.q = g
b.x = c
d.t = n
c.p = g
a.s = c
a.p = b
a.y = f
assert f.z.s.p.s.p.txt == "g"