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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: F = None
        self.v: E = None
        self.w: A = None
        self.o: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: E = None
        self.q: C = None
        self.u: H = None
        self.r: F = None
        self.t: F = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: B = None
        self.y: B = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: F = None
        self.v: E = None
        self.w: A = None
        self.o: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: E = None
        self.q: C = None
        self.u: H = None
        self.r: F = None
        self.t: F = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: B = None
        self.y: B = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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