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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

c.q = k
c.t = h
g.q = f
g.s = j
g.z = a
g.o = h
n.y = b
n.p = g
k.o = g
k.v = g
k.s = g
a.q = g
a.w = j
m.q = f
h.x = c
b.q = f
j.o = g
j.v = g
j.s = g
f.y = b
f.p = g
assert g.s.s.z.txt == "a"