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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: D = None
        self.t: E = None
        self.v: D = None
        self.txt = txt

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

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

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

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

e = A("e")
f = B("f")
j = C("j")
d = D("d")
g = E("g")
a = F("a")
b = G("b")

e.s = d
e.q = g
f.x = d
f.p = g
f.u = a
f.o = j
f.q = j
f.t = j
f.y = e
j.x = e
j.z = d
j.v = d
j.t = g
d.z = a
d.o = g
d.u = j
d.q = b
g.w = b
g.q = d
a.s = g
b.x = e
b.z = f
b.w = d
assert g.q.q.z.y.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: D = None
        self.t: E = None
        self.v: D = None
        self.txt = txt

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

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

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

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

e = A("e")
f = B("f")
j = C("j")
d = D("d")
g = E("g")
a = F("a")
b = G("b")

e.s = d
e.q = g
f.x = d
f.p = g
f.u = a
f.o = j
f.q = j
f.t = j
f.y = e
j.x = e
j.z = d
j.v = d
j.t = g
d.z = a
d.o = g
d.u = j
d.q = b
g.w = b
g.q = d
a.s = g
b.x = e
b.z = f
b.w = d
assert g.q.q.z.y.s.q.txt == "b"