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

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

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

c = A("c")
n = B("n")
l = C("l")
j = A("j")
e = C("e")
f = B("f")
i = C("i")

c.r = j
n.o = i
n.y = f
n.w = f
l.s = c
l.v = f
l.y = j
j.r = c
e.s = j
e.v = n
e.y = c
f.o = l
f.y = n
f.w = n
i.s = c
i.y = c
i.v = f
assert c.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

c = A("c")
n = B("n")
l = C("l")
j = A("j")
e = C("e")
f = B("f")
i = C("i")

c.r = j
n.o = i
n.y = f
n.w = f
l.s = c
l.v = f
l.y = j
j.r = c
e.s = j
e.v = n
e.y = c
f.o = l
f.y = n
f.w = n
i.s = c
i.y = c
i.v = f
assert c.r.r.r.r.r.r.txt == "c"