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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: G = None
        self.w: D = None
        self.r: G = None
        self.s: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: C = None
        self.y: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: E = None
        self.v: F = None
        self.z: B = None
        self.x: G = None
        self.txt = txt

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

n = A("n")
i = B("i")
h = C("h")
d = D("d")
j = E("j")
c = F("c")
a = G("a")
g = F("g")

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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: G = None
        self.w: D = None
        self.r: G = None
        self.s: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: C = None
        self.y: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: E = None
        self.v: F = None
        self.z: B = None
        self.x: G = None
        self.txt = txt

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

n = A("n")
i = B("i")
h = C("h")
d = D("d")
j = E("j")
c = F("c")
a = G("a")
g = F("g")

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