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

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

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

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

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

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

c = A("c")
h = B("h")
g = C("g")
f = D("f")
j = E("j")
d = F("d")
n = B("n")
k = D("k")

c.s = k
c.z = k
c.r = f
c.p = h
h.s = d
h.t = f
g.p = f
g.x = d
f.v = n
f.p = k
f.u = k
f.w = k
j.w = g
j.p = n
d.p = k
n.s = d
n.t = k
k.v = n
k.p = f
k.u = f
k.w = f
assert k.v.s.p.p.w.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: D = None
        self.p: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

c = A("c")
h = B("h")
g = C("g")
f = D("f")
j = E("j")
d = F("d")
n = B("n")
k = D("k")

c.s = k
c.z = k
c.r = f
c.p = h
h.s = d
h.t = f
g.p = f
g.x = d
f.v = n
f.p = k
f.u = k
f.w = k
j.w = g
j.p = n
d.p = k
n.s = d
n.t = k
k.v = n
k.p = f
k.u = f
k.w = f
assert k.v.s.p.p.w.v.s.txt == "d"