class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: H = None
        self.q: G = None
        self.o: F = None
        self.r: B = None
        self.v: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: H = None
        self.txt = txt

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

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

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

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

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

h = A("h")
l = B("l")
e = C("e")
j = D("j")
a = E("a")
g = F("g")
b = G("b")
d = H("d")
n = C("n")

h.t = j
h.u = d
h.q = b
h.o = g
h.v = g
h.r = l
l.u = a
l.q = j
l.p = d
e.q = l
e.x = d
j.z = l
j.r = h
j.p = a
a.w = h
a.y = h
a.x = d
g.z = e
b.u = l
b.p = l
b.s = l
b.x = d
b.z = d
b.y = n
d.z = g
d.y = n
d.w = l
n.q = l
n.x = d
assert n.x.z.z.q.q.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: H = None
        self.q: G = None
        self.o: F = None
        self.r: B = None
        self.v: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: H = None
        self.txt = txt

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

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

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

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

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

h = A("h")
l = B("l")
e = C("e")
j = D("j")
a = E("a")
g = F("g")
b = G("b")
d = H("d")
n = C("n")

h.t = j
h.u = d
h.q = b
h.o = g
h.v = g
h.r = l
l.u = a
l.q = j
l.p = d
e.q = l
e.x = d
j.z = l
j.r = h
j.p = a
a.w = h
a.y = h
a.x = d
g.z = e
b.u = l
b.p = l
b.s = l
b.x = d
b.z = d
b.y = n
d.z = g
d.y = n
d.w = l
n.q = l
n.x = d
assert n.x.z.z.q.q.z.p.txt == "d"