#include<bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using ordset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
less<T> can be changed to:
1. less_equal<T>
2. greater<T>
ordered_set functions:
1. *(os.find_by_order(x)) -> return the value at position x (0 base)
2. os.order_of_key(x) -> return the number of elements less than x
*/
typedef long long ll;
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
const int MOD=1000000007;
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define fios(); ios_base::sync_with_stdio(0);cin.tie(0);
#define fraction(x); cout.unsetf(ios::floatfield); cout.precision(x); cout.setf(ios::fixed,ios::floatfield);
#define file(); freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
int count_triples(vector<int32_t> a){
int n=a.size();
int ans=0;
map<int,int> fre;
for(int j=0;j<n;j++) {
for(int i=0;i<=n;i++) fre[i]=0;
for(int i=0;i<j;i++) fre[a[i]]++;
for(int k=j+1;k<n;k++){
int need=a[k]-a[j];
if(need>0&&need<=n&&fre[need]>0) ans+=fre[need];
}
}
return ans;
}
vector<int32_t> construct_range(int32_t M, int32_t K){
vector<int> ans(M,1);
if(M>500) return ans;
ans[0]=1,ans[1]=2;
for(int i=3;i<M;i++){
int mx=0,add=1;
for(int cur=1;cur<=10;cur++){
vector<int> v;
v.insert(v.end(),ans.begin(),ans.begin()+i+1);
v.pb(cur);
int tem=count_triples(v);
if(tem>mx) add=cur;
mx=max(tem,mx);
}
ans[i]=add;
}
return ans;
}