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

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

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

class D:
    def __init__(self, txt: str):
        self.u: H = None
        self.t: B = None
        self.s: C = None
        self.z: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.s: D = None
        self.x: D = None
        self.o: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: H = None
        self.t: B = None
        self.s: C = None
        self.z: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.s: D = None
        self.x: D = None
        self.o: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

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

g.q = e
n.q = g
n.s = i
n.o = j
d.z = e
h.u = k
h.t = n
h.z = n
h.s = d
j.y = e
j.s = h
j.x = h
j.o = n
e.u = k
e.v = j
a.y = g
a.o = g
k.v = a
i.y = g
i.o = g
assert d.z.u.v.y.txt == "g"