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

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: F = None
        self.r: A = None
        self.o: G = None
        self.txt = txt

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

a.p = d
a.q = d
a.y = n
a.u = m
a.z = g
a.x = k
m.p = h
k.p = d
k.u = h
k.t = h
d.u = f
i.t = m
h.p = n
h.q = i
n.y = h
g.w = h
g.r = a
g.o = n
f.y = h
assert n.y.q.t.p.p.y.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: D = None
        self.y: G = None
        self.u: B = None
        self.z: H = None
        self.x: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: F = None
        self.r: A = None
        self.o: G = None
        self.txt = txt

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

a.p = d
a.q = d
a.y = n
a.u = m
a.z = g
a.x = k
m.p = h
k.p = d
k.u = h
k.t = h
d.u = f
i.t = m
h.p = n
h.q = i
n.y = h
g.w = h
g.r = a
g.o = n
f.y = h
assert n.y.q.t.p.p.y.q.t.txt == "m"