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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: B = None
        self.s: B = None
        self.w: D = None
        self.q: E = None
        self.u: B = None
        self.txt = txt

g = A("g")
n = B("n")
b = C("b")
k = D("k")
c = E("c")
l = F("l")
m = F("m")

g.s = l
g.y = b
n.o = k
n.z = g
n.y = l
n.x = m
n.w = m
b.w = n
k.y = n
k.x = n
k.w = g
k.s = b
c.u = g
c.o = m
l.z = n
l.t = n
l.s = n
l.u = n
l.w = k
l.q = c
m.z = n
m.t = n
m.s = n
m.u = n
m.w = k
m.q = c
assert b.w.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.y: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: B = None
        self.s: B = None
        self.w: D = None
        self.q: E = None
        self.u: B = None
        self.txt = txt

g = A("g")
n = B("n")
b = C("b")
k = D("k")
c = E("c")
l = F("l")
m = F("m")

g.s = l
g.y = b
n.o = k
n.z = g
n.y = l
n.x = m
n.w = m
b.w = n
k.y = n
k.x = n
k.w = g
k.s = b
c.u = g
c.o = m
l.z = n
l.t = n
l.s = n
l.u = n
l.w = k
l.q = c
m.z = n
m.t = n
m.s = n
m.u = n
m.w = k
m.q = c
assert b.w.w.q.txt == "c"