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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: D = None
        self.z: F = None
        self.s: F = None
        self.p: G = 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.p: E = None
        self.y: F = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: D = None
        self.z: F = None
        self.s: F = None
        self.p: G = 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.p: E = None
        self.y: F = None
        self.q: F = None
        self.txt = txt

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

k.x = f
k.o = g
k.q = g
k.s = n
k.p = d
d.q = g
n.q = f
g.v = k
g.o = n
b.x = n
b.w = g
b.z = j
b.s = j
b.p = f
j.q = n
f.p = b
f.y = j
f.q = j
assert k.s.q.q.q.q.p.w.txt == "g"