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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: F = None
        self.y: C = None
        self.w: C = None
        self.u: F = None
        self.x: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: E = None
        self.txt = txt

n = A("n")
e = B("e")
l = C("l")
h = D("h")
g = E("g")
f = F("f")

n.z = f
n.o = g
n.q = h
e.q = g
e.p = f
e.u = f
e.y = l
e.w = l
e.x = h
l.o = g
l.w = g
l.x = n
l.v = n
l.p = h
h.w = l
h.p = g
h.q = e
g.s = f
g.t = f
g.z = e
f.p = e
f.r = g
assert f.r.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: E = None
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: F = None
        self.y: C = None
        self.w: C = None
        self.u: F = None
        self.x: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: E = None
        self.txt = txt

n = A("n")
e = B("e")
l = C("l")
h = D("h")
g = E("g")
f = F("f")

n.z = f
n.o = g
n.q = h
e.q = g
e.p = f
e.u = f
e.y = l
e.w = l
e.x = h
l.o = g
l.w = g
l.x = n
l.v = n
l.p = h
h.w = l
h.p = g
h.q = e
g.s = f
g.t = f
g.z = e
f.p = e
f.r = g
assert f.r.z.q.txt == "g"