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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: C = None
        self.y: F = None
        self.r: F = None
        self.s: C = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: B = None
        self.q: A = None
        self.y: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: E = None
        self.y: G = None
        self.s: D = None
        self.txt = txt

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

m.q = i
l.r = k
h.s = g
g.q = l
g.t = h
g.s = h
g.y = c
g.r = k
g.z = f
f.z = m
f.q = m
f.s = l
f.y = c
c.q = a
c.p = k
i.v = m
i.r = f
i.y = d
i.s = g
d.v = m
d.r = f
d.y = i
d.s = g
k.q = a
k.p = c
a.q = l
a.t = h
a.s = h
a.y = c
a.r = k
a.z = f
assert f.y.q.s.s.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: C = None
        self.y: F = None
        self.r: F = None
        self.s: C = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: B = None
        self.q: A = None
        self.y: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: E = None
        self.y: G = None
        self.s: D = None
        self.txt = txt

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

m.q = i
l.r = k
h.s = g
g.q = l
g.t = h
g.s = h
g.y = c
g.r = k
g.z = f
f.z = m
f.q = m
f.s = l
f.y = c
c.q = a
c.p = k
i.v = m
i.r = f
i.y = d
i.s = g
d.v = m
d.r = f
d.y = i
d.s = g
k.q = a
k.p = c
a.q = l
a.t = h
a.s = h
a.y = c
a.r = k
a.z = f
assert f.y.q.s.s.r.p.txt == "c"