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

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: A = None
        self.txt = txt

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

h = A("h")
d = B("d")
f = C("f")
c = D("c")
a = B("a")
i = B("i")
n = B("n")
k = A("k")

h.v = n
h.q = i
h.s = k
d.z = h
d.y = c
d.s = f
f.v = c
f.o = h
c.x = h
c.s = k
c.p = k
a.z = k
a.y = c
a.s = f
i.z = k
i.y = c
i.s = f
n.z = k
n.y = c
n.s = f
k.v = a
k.q = a
k.s = h
assert a.s.v.x.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: B = None
        self.s: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: A = None
        self.txt = txt

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

h = A("h")
d = B("d")
f = C("f")
c = D("c")
a = B("a")
i = B("i")
n = B("n")
k = A("k")

h.v = n
h.q = i
h.s = k
d.z = h
d.y = c
d.s = f
f.v = c
f.o = h
c.x = h
c.s = k
c.p = k
a.z = k
a.y = c
a.s = f
i.z = k
i.y = c
i.s = f
n.z = k
n.y = c
n.s = f
k.v = a
k.q = a
k.s = h
assert a.s.v.x.s.s.s.txt == "k"