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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: F = None
        self.t: E = None
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: A = None
        self.s: A = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: A = None
        self.p: B = None
        self.s: D = None
        self.txt = txt

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

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

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

n.o = g
g.w = e
d.r = e
d.t = e
d.x = c
d.w = g
k.t = c
k.r = n
k.s = n
k.v = d
e.z = g
e.p = g
e.v = n
e.s = k
c.s = d
c.o = n
h.q = e
h.x = e
f.q = e
f.x = e
assert f.x.z.w.z.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: F = None
        self.t: E = None
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: A = None
        self.s: A = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: A = None
        self.p: B = None
        self.s: D = None
        self.txt = txt

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

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

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

n.o = g
g.w = e
d.r = e
d.t = e
d.x = c
d.w = g
k.t = c
k.r = n
k.s = n
k.v = d
e.z = g
e.p = g
e.v = n
e.s = k
c.s = d
c.o = n
h.q = e
h.x = e
f.q = e
f.x = e
assert f.x.z.w.z.w.s.txt == "k"