class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: F = None
        self.p: E = None
        self.r: F = None
        self.txt = txt

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

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

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

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

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

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

k.t = n
k.v = n
k.r = n
k.p = h
i.p = k
l.t = e
l.r = n
l.s = h
l.w = h
e.u = h
e.v = h
h.x = n
h.z = m
h.r = k
n.w = e
d.p = k
b.t = e
b.r = n
b.s = h
b.w = h
m.t = e
m.r = n
m.s = h
m.w = h
assert m.r.w.v.x.w.u.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: F = None
        self.p: E = None
        self.r: F = None
        self.txt = txt

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

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

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

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

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

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

k.t = n
k.v = n
k.r = n
k.p = h
i.p = k
l.t = e
l.r = n
l.s = h
l.w = h
e.u = h
e.v = h
h.x = n
h.z = m
h.r = k
n.w = e
d.p = k
b.t = e
b.r = n
b.s = h
b.w = h
m.t = e
m.r = n
m.s = h
m.w = h
assert m.r.w.v.x.w.u.z.s.txt == "h"