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

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

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

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

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

f = A("f")
k = B("k")
i = C("i")
e = D("e")
n = E("n")
m = D("m")
h = C("h")

f.p = k
f.y = n
f.x = n
k.s = n
i.x = n
i.v = k
e.s = f
e.p = n
n.z = h
m.s = f
m.p = n
h.x = n
h.v = k
assert f.p.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

f = A("f")
k = B("k")
i = C("i")
e = D("e")
n = E("n")
m = D("m")
h = C("h")

f.p = k
f.y = n
f.x = n
k.s = n
i.x = n
i.v = k
e.s = f
e.p = n
n.z = h
m.s = f
m.p = n
h.x = n
h.v = k
assert f.p.s.z.txt == "h"