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

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

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

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

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

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

e = A("e")
n = B("n")
g = C("g")
a = D("a")
f = E("f")
d = F("d")

e.p = d
e.y = n
e.z = g
n.w = g
n.q = a
g.v = e
g.p = e
a.s = e
a.v = e
a.o = e
a.p = e
a.w = f
a.y = d
f.s = e
f.z = e
f.q = e
f.u = d
f.p = n
d.p = f
d.y = f
d.u = e
d.x = g
d.z = n
d.q = a
assert d.q.s.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: B = None
        self.z: C = None
        self.txt = txt

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

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

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

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

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

e = A("e")
n = B("n")
g = C("g")
a = D("a")
f = E("f")
d = F("d")

e.p = d
e.y = n
e.z = g
n.w = g
n.q = a
g.v = e
g.p = e
a.s = e
a.v = e
a.o = e
a.p = e
a.w = f
a.y = d
f.s = e
f.z = e
f.q = e
f.u = d
f.p = n
d.p = f
d.y = f
d.u = e
d.x = g
d.z = n
d.q = a
assert d.q.s.y.q.txt == "a"