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

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

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

f = A("f")
l = B("l")
c = C("c")
m = B("m")
n = A("n")
a = A("a")
i = C("i")
j = A("j")
d = C("d")

f.o = m
l.v = m
l.x = j
l.o = j
c.r = d
c.w = i
m.v = l
m.x = n
m.o = j
n.o = m
a.o = m
i.r = c
i.w = d
j.o = l
d.r = i
d.w = c
assert i.w.r.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
c = C("c")
m = B("m")
n = A("n")
a = A("a")
i = C("i")
j = A("j")
d = C("d")

f.o = m
l.v = m
l.x = j
l.o = j
c.r = d
c.w = i
m.v = l
m.x = n
m.o = j
n.o = m
a.o = m
i.r = c
i.w = d
j.o = l
d.r = i
d.w = c
assert i.w.r.w.r.txt == "i"