Is it coincidence? I do this is just the beginning modulo 9, but not through, and finally into a direct AC 8
#include <iostream>
using namespace std;
int main(){
int f[10];
int n;
while(cin>>n){
f[0]=7%3;
f[1]=11%3;
for(int i=2;i<9;i++){
f[i]=(f[i-1]+f[i-2])%3;
}
if(f[n%8]==0)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
return 0;
}