class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: C = None
        self.y: A = None
        self.w: G = None
        self.x: E = None
        self.o: C = None
        self.t: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

n = A("n")
i = B("i")
k = C("k")
e = D("e")
a = E("a")
d = F("d")
b = G("b")

n.y = b
i.p = d
i.z = k
i.o = k
i.y = n
i.t = n
i.w = b
i.x = a
k.y = n
k.v = e
e.t = d
a.p = k
d.w = a
b.w = i
assert n.y.w.o.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: C = None
        self.y: A = None
        self.w: G = None
        self.x: E = None
        self.o: C = None
        self.t: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

n = A("n")
i = B("i")
k = C("k")
e = D("e")
a = E("a")
d = F("d")
b = G("b")

n.y = b
i.p = d
i.z = k
i.o = k
i.y = n
i.t = n
i.w = b
i.x = a
k.y = n
k.v = e
e.t = d
a.p = k
d.w = a
b.w = i
assert n.y.w.o.y.y.txt == "b"