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

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

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

j = A("j")
e = B("e")
n = C("n")
h = B("h")
i = B("i")
b = C("b")
l = B("l")
m = C("m")

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

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

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

j = A("j")
e = B("e")
n = C("n")
h = B("h")
i = B("i")
b = C("b")
l = B("l")
m = C("m")

j.w = e
j.v = i
j.s = n
e.v = h
e.w = b
n.r = b
n.v = j
n.x = j
h.v = i
h.w = n
i.v = l
i.w = b
b.r = n
b.v = j
b.x = j
l.v = e
l.w = m
m.r = n
m.v = j
m.x = j
assert j.w.w.r.x.v.txt == "i"