class A:
    def __init__(self, txt: str):
        self.v: G = None
        self.q: F = None
        self.x: C = None
        self.y: G = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: G = None
        self.v: D = None
        self.r: D = None
        self.u: C = None
        self.x: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: F = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: G = None
        self.v: D = None
        self.r: D = None
        self.u: C = None
        self.x: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: F = None
        self.s: A = None
        self.txt = txt

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

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