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

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: E = None
        self.t: A = None
        self.o: C = None
        self.txt = txt

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

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

g = A("g")
c = B("c")
a = C("a")
n = D("n")
i = E("i")
m = F("m")
k = B("k")
h = E("h")

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: E = None
        self.t: A = None
        self.o: C = None
        self.txt = txt

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

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

g = A("g")
c = B("c")
a = C("a")
n = D("n")
i = E("i")
m = F("m")
k = B("k")
h = E("h")

g.s = n
c.o = a
a.y = c
a.u = k
n.r = g
n.t = g
n.w = i
n.o = a
i.z = a
i.q = n
m.v = i
m.t = n
k.o = a
h.z = a
h.q = n
assert n.r.s.w.z.u.o.u.o.txt == "a"