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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: F = None
        self.x: D = None
        self.t: D = None
        self.w: A = None
        self.p: C = None
        self.txt = txt

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

d = A("d")
n = B("n")
g = C("g")
m = D("m")
a = E("a")
k = F("k")

d.o = n
n.y = a
n.z = d
n.w = k
n.v = m
g.s = d
g.x = a
g.w = n
m.u = k
m.y = k
a.o = g
a.p = g
a.s = k
a.x = m
a.t = m
a.w = d
k.s = a
k.z = m
assert g.w.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.y: E = None
        self.z: A = None
        self.w: F = None
        self.v: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: F = None
        self.x: D = None
        self.t: D = None
        self.w: A = None
        self.p: C = None
        self.txt = txt

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

d = A("d")
n = B("n")
g = C("g")
m = D("m")
a = E("a")
k = F("k")

d.o = n
n.y = a
n.z = d
n.w = k
n.v = m
g.s = d
g.x = a
g.w = n
m.u = k
m.y = k
a.o = g
a.p = g
a.s = k
a.x = m
a.t = m
a.w = d
k.s = a
k.z = m
assert g.w.w.s.txt == "a"