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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: A = None
        self.x: A = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: A = None
        self.x: A = None
        self.txt = txt

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

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

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

k.y = a
i.y = a
c.q = i
c.o = n
a.p = c
a.s = i
g.p = i
g.o = n
g.x = n
f.t = g
f.z = n
j.p = f
h.q = i
h.o = n
d.t = g
d.z = n
n.y = a
assert k.y.s.y.s.y.p.o.y.p.o.txt == "n"