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

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

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.z: B = None
        self.v: C = None
        self.u: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: C = None
        self.v: C = None
        self.r: D = None
        self.z: A = None
        self.txt = txt

n = A("n")
d = B("d")
a = C("a")
e = D("e")
k = E("k")
l = F("l")
h = A("h")

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.z: B = None
        self.v: C = None
        self.u: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: C = None
        self.v: C = None
        self.r: D = None
        self.z: A = None
        self.txt = txt

n = A("n")
d = B("d")
a = C("a")
e = D("e")
k = E("k")
l = F("l")
h = A("h")

n.x = e
n.q = e
n.u = l
n.o = h
n.z = k
d.z = e
a.t = h
a.v = d
e.r = l
e.z = d
e.u = d
e.v = a
k.x = d
k.u = e
k.s = h
l.o = a
l.s = a
l.v = a
l.r = e
l.z = n
h.x = e
h.q = e
h.u = l
h.o = n
h.z = k
assert l.z.z.s.q.r.z.txt == "n"