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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: G = None
        self.w: F = None
        self.q: C = None
        self.v: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: B = None
        self.o: C = None
        self.p: A = None
        self.s: D = None
        self.txt = txt

g = A("g")
a = B("a")
l = C("l")
k = D("k")
n = E("n")
i = F("i")
f = G("f")

g.x = n
g.w = l
a.q = f
a.w = l
l.w = f
k.q = g
n.z = k
n.x = f
n.v = f
n.w = i
n.q = l
i.v = f
i.w = l
i.u = a
i.t = k
i.p = k
i.o = g
f.t = a
f.y = a
f.o = l
f.p = g
f.s = k
assert a.q.p.x.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.w: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: G = None
        self.w: F = None
        self.q: C = None
        self.v: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: B = None
        self.o: C = None
        self.p: A = None
        self.s: D = None
        self.txt = txt

g = A("g")
a = B("a")
l = C("l")
k = D("k")
n = E("n")
i = F("i")
f = G("f")

g.x = n
g.w = l
a.q = f
a.w = l
l.w = f
k.q = g
n.z = k
n.x = f
n.v = f
n.w = i
n.q = l
i.v = f
i.w = l
i.u = a
i.t = k
i.p = k
i.o = g
f.t = a
f.y = a
f.o = l
f.p = g
f.s = k
assert a.q.p.x.z.q.txt == "g"