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

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

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

h = A("h")
m = B("m")
i = C("i")
j = C("j")
g = A("g")
a = C("a")
f = B("f")
l = C("l")
n = B("n")

h.x = a
h.p = m
h.w = n
m.w = j
m.s = n
i.v = j
i.w = h
j.v = i
j.w = h
g.x = l
g.p = m
g.w = n
a.v = j
a.w = g
f.w = i
f.s = n
l.v = a
l.w = h
n.w = l
n.s = f
assert l.w.w.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.w: B = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
i = C("i")
j = C("j")
g = A("g")
a = C("a")
f = B("f")
l = C("l")
n = B("n")

h.x = a
h.p = m
h.w = n
m.w = j
m.s = n
i.v = j
i.w = h
j.v = i
j.w = h
g.x = l
g.p = m
g.w = n
a.v = j
a.w = g
f.w = i
f.s = n
l.v = a
l.w = h
n.w = l
n.s = f
assert l.w.w.s.s.s.txt == "f"