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

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

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

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

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

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

n = A("n")
a = B("a")
e = C("e")
h = D("h")
c = E("c")
f = F("f")
k = E("k")

n.s = a
a.r = h
a.v = h
a.p = h
e.w = a
e.r = f
h.z = f
h.r = e
h.v = c
c.u = n
c.s = h
c.z = h
c.o = a
c.v = e
f.u = h
f.x = a
k.u = n
k.s = h
k.z = h
k.o = a
k.v = e
assert k.z.v.o.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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

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

n = A("n")
a = B("a")
e = C("e")
h = D("h")
c = E("c")
f = F("f")
k = E("k")

n.s = a
a.r = h
a.v = h
a.p = h
e.w = a
e.r = f
h.z = f
h.r = e
h.v = c
c.u = n
c.s = h
c.z = h
c.o = a
c.v = e
f.u = h
f.x = a
k.u = n
k.s = h
k.z = h
k.o = a
k.v = e
assert k.z.v.o.r.z.txt == "f"