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

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: E = None
        self.u: B = None
        self.w: F = None
        self.txt = txt

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

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

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

n = A("n")
d = B("d")
c = C("c")
h = D("h")
k = E("k")
m = F("m")

n.s = d
n.p = d
d.v = k
d.z = h
c.s = d
c.u = d
c.o = k
c.w = m
h.u = m
h.s = c
h.o = c
h.x = k
h.y = k
h.v = n
k.o = n
k.s = m
k.w = m
k.u = d
k.t = d
m.q = h
m.p = h
m.y = n
m.z = k
assert m.q.x.o.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: E = None
        self.u: B = None
        self.w: F = None
        self.txt = txt

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

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

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

n = A("n")
d = B("d")
c = C("c")
h = D("h")
k = E("k")
m = F("m")

n.s = d
n.p = d
d.v = k
d.z = h
c.s = d
c.u = d
c.o = k
c.w = m
h.u = m
h.s = c
h.o = c
h.x = k
h.y = k
h.v = n
k.o = n
k.s = m
k.w = m
k.u = d
k.t = d
m.q = h
m.p = h
m.y = n
m.z = k
assert m.q.x.o.s.z.txt == "h"