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

class B:
    def __init__(self, txt: str):
        self.z: H = None
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: H = None
        self.t: G = None
        self.p: D = None
        self.w: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: C = None
        self.x: G = None
        self.u: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: B = None
        self.p: H = None
        self.u: G = None
        self.r: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: F = None
        self.o: F = None
        self.x: C = None
        self.txt = txt

m = A("m")
i = B("i")
f = C("f")
b = D("b")
d = E("d")
n = F("n")
e = G("e")
g = H("g")

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

class B:
    def __init__(self, txt: str):
        self.z: H = None
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: H = None
        self.t: G = None
        self.p: D = None
        self.w: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: C = None
        self.x: G = None
        self.u: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: B = None
        self.p: H = None
        self.u: G = None
        self.r: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: F = None
        self.o: F = None
        self.x: C = None
        self.txt = txt

m = A("m")
i = B("i")
f = C("f")
b = D("b")
d = E("d")
n = F("n")
e = G("e")
g = H("g")

m.p = i
i.z = g
i.w = n
f.x = g
f.t = e
f.w = e
f.p = b
b.t = d
b.u = d
b.s = f
b.x = e
d.p = g
d.t = m
d.o = e
n.y = f
n.s = i
n.p = g
n.u = e
n.r = m
e.p = n
g.y = m
g.p = n
g.o = n
g.x = f
assert e.p.s.z.o.u.p.txt == "n"