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

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.y: C = None
        self.w: E = None
        self.s: B = None
        self.p: F = None
        self.o: F = None
        self.v: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: F = None
        self.y: F = None
        self.q: B = None
        self.t: F = None
        self.o: G = None
        self.p: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: A = None
        self.z: A = None
        self.x: F = None
        self.q: C = None
        self.y: A = None
        self.p: A = None
        self.txt = txt

e = A("e")
d = B("d")
a = C("a")
k = D("k")
i = E("i")
m = F("m")
f = G("f")

e.q = d
d.z = m
a.q = e
a.w = d
k.u = f
k.v = f
k.y = a
k.w = i
k.s = d
k.p = m
k.o = m
i.u = m
i.v = m
i.y = m
i.t = m
i.q = d
i.o = f
i.p = k
m.q = f
f.o = i
f.r = e
f.z = e
f.y = e
f.p = e
f.x = m
f.q = a
assert a.w.z.q.x.q.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.y: C = None
        self.w: E = None
        self.s: B = None
        self.p: F = None
        self.o: F = None
        self.v: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: F = None
        self.y: F = None
        self.q: B = None
        self.t: F = None
        self.o: G = None
        self.p: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: A = None
        self.z: A = None
        self.x: F = None
        self.q: C = None
        self.y: A = None
        self.p: A = None
        self.txt = txt

e = A("e")
d = B("d")
a = C("a")
k = D("k")
i = E("i")
m = F("m")
f = G("f")

e.q = d
d.z = m
a.q = e
a.w = d
k.u = f
k.v = f
k.y = a
k.w = i
k.s = d
k.p = m
k.o = m
i.u = m
i.v = m
i.y = m
i.t = m
i.q = d
i.o = f
i.p = k
m.q = f
f.o = i
f.r = e
f.z = e
f.y = e
f.p = e
f.x = m
f.q = a
assert a.w.z.q.x.q.x.q.txt == "f"