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

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

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

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

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

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