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

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

class C:
    def __init__(self, txt: str):
        self.p: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: J = None
        self.p: B = None
        self.z: J = None
        self.u: B = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: J = None
        self.u: J = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.y: I = None
        self.u: B = None
        self.o: B = None
        self.r: E = None
        self.q: C = None
        self.w: G = None
        self.x: D = None
        self.z: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: J = None
        self.p: B = None
        self.z: J = None
        self.u: B = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: J = None
        self.u: J = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.y: I = None
        self.u: B = None
        self.o: B = None
        self.r: E = None
        self.q: C = None
        self.w: G = None
        self.x: D = None
        self.z: C = None
        self.txt = txt

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

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