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

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

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

class D:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: C = None
        self.s: D = None
        self.p: C = None
        self.w: A = None
        self.v: E = None
        self.y: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: C = None
        self.s: D = None
        self.p: C = None
        self.w: A = None
        self.v: E = None
        self.y: C = None
        self.txt = txt

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

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