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

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.q: F = None
        self.o: A = None
        self.z: F = None
        self.v: A = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.q: F = None
        self.o: A = None
        self.z: F = None
        self.v: A = None
        self.s: B = None
        self.txt = txt

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

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

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

c.q = f
h.r = c
h.y = f
l.q = c
l.w = i
f.t = h
f.s = h
f.q = g
f.o = c
f.v = c
f.z = i
d.w = n
k.q = f
k.w = d
n.w = d
g.q = f
g.w = d
i.q = f
i.w = n
assert l.w.q.v.q.z.q.o.q.q.txt == "g"