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

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

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

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

l = A("l")
j = B("j")
n = C("n")
i = D("i")
g = A("g")
f = A("f")
a = C("a")
d = D("d")

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

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

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

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

l = A("l")
j = B("j")
n = C("n")
i = D("i")
g = A("g")
f = A("f")
a = C("a")
d = D("d")

l.w = n
l.y = j
j.w = n
j.r = n
n.s = a
n.p = a
n.v = a
n.w = j
i.v = d
i.x = d
i.s = l
i.y = l
g.w = a
g.y = j
f.w = n
f.y = j
a.s = n
a.p = n
a.v = n
a.w = j
d.v = i
d.x = i
d.s = f
d.y = g
assert i.x.v.s.txt == "l"