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

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

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

e = A("e")
a = B("a")
b = C("b")
d = A("d")
c = C("c")
j = C("j")
n = A("n")
m = B("m")

e.r = n
e.v = n
e.o = c
a.r = b
a.t = m
b.s = j
b.w = c
d.r = e
d.v = e
d.o = b
c.s = j
c.w = b
j.s = b
j.w = c
n.r = e
n.v = e
n.o = j
m.r = c
m.t = a
assert j.w.w.w.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: A = None
        self.o: C = None
        self.txt = txt

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

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

e = A("e")
a = B("a")
b = C("b")
d = A("d")
c = C("c")
j = C("j")
n = A("n")
m = B("m")

e.r = n
e.v = n
e.o = c
a.r = b
a.t = m
b.s = j
b.w = c
d.r = e
d.v = e
d.o = b
c.s = j
c.w = b
j.s = b
j.w = c
n.r = e
n.v = e
n.o = j
m.r = c
m.t = a
assert j.w.w.w.s.s.s.s.s.txt == "j"