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

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

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

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

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

h.v = l
h.x = c
h.y = i
h.p = k
f.z = e
f.x = h
f.y = i
f.o = i
i.p = f
i.r = e
i.w = e
i.t = l
c.v = e
c.r = n
c.s = m
l.v = h
l.x = c
l.y = k
l.p = i
m.z = e
m.x = l
m.y = i
m.o = i
k.p = m
k.r = l
k.w = l
k.t = h
e.v = l
e.x = c
e.y = i
e.p = i
n.v = l
n.r = c
n.s = f
assert n.s.o.t.v.p.w.v.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: D = None
        self.y: C = None
        self.p: C = None
        self.txt = txt

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

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

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

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

h.v = l
h.x = c
h.y = i
h.p = k
f.z = e
f.x = h
f.y = i
f.o = i
i.p = f
i.r = e
i.w = e
i.t = l
c.v = e
c.r = n
c.s = m
l.v = h
l.x = c
l.y = k
l.p = i
m.z = e
m.x = l
m.y = i
m.o = i
k.p = m
k.r = l
k.w = l
k.t = h
e.v = l
e.x = c
e.y = i
e.p = i
n.v = l
n.r = c
n.s = f
assert n.s.o.t.v.p.w.v.p.t.txt == "h"