This is a very simply formulated task. Let's call an integer number `N` 'green' if `N²` ends with all of the digits of `N`. Some examples:

`5` is green, because `5² = 25` and `25` ends with `5`.

`11` is not green, because `11² = 121` and `121` does not end with `11`.

`376` is green, because `376² = 141376` and `141376` ends with `376`.

Your task is to write a function `green` that returns `n`th green number, starting with `1` - `green (1) == 1`

---

## Data range

```if:haskell
`n <= 4000` for Haskell
```
```if:java
`n <= 5000` for Java
```
```if:python
`n <= 5000` for Python
```
```if:javascript
`n <= 3000` for JavaScript

Return values should be `String`s, and should be exact. A BigNum library is recommended.
```

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

def _disabled_input(*args, **kwargs):
    raise RuntimeError("input() is disabled in callable mode")
builtins.input = _disabled_input

ns = {"__name__": "__judge__"}  # prevent if __name__ == "__main__" blocks
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'from itertools import chain\n\n_A018247 = 5507892033556035791371792629100237682598738962094476369972059049452967441587235634931674339622473574280821288168320446695679536039427053255909563977956500647500412691563755880886167774411122846515042057934210324478787281919538790000999616163222123020708764047374316493711188552949294878761965336956393647858527684320631232701555116292227575140464720491283762688439233984347879300562313950958674740106476704211178477509147003836984296147755270995029269684109343202879183739584798683715241551429647234717808588582623277297576686008949743753409688387939096222728882689374022112371252012273120606174751574751537381989074240665252066611148827637678947177773960015235903946894098140630385847547907319150251760258945788659491966429549908540773478285449868640866567399269578082162283572603026954569487924380165488488051064862760620827164159132523609790500938385405426324719893931802209823600162545177681029159396504506657809033052772198385286341879645511424748536307235457049044509125214234275955491843973984458712528694819826927029255264834903206526851272202961318699947776535481291519857640422968183091773445277723200737603825883172729279563657419014445235954319103063572496178988203175787761062137708080967811374931911766563031490205784352509572880668464121069252802275061298511616206384006778979402449023875111258689534549514888200678667702341002839549282970286447273625217535443197911855068157264858804852673871684804002188529473022223344541221328464844153593793663133604458940328723478401947357560361346212008675373346913314338717350880212600285752985386643931022326553454776845029957025561658143370236502074744856814787872902092412582905301249124668868351587677499891768678715728134940879276894529797097772305403356618828198702210630557967239806611190197744642421025136748701117131278125400133690086034889084364023875765936821979626181917833520492704199324875237825867148278905344897440142612317035699548419499444610608146207254036559998271588356035049327795540741961849280952093753026852390937562839148571612367351970609224242398777007574955787271559767413458997537695515862718887941516307569668816352155048898271704378508028434084412644126821848514157729916034497017892335796684991447389566001932545827678000618329854426232827257556110733160697015864984222291255485729879337147866323172405515756102352543994999345608083801190741530060056055744818709692785099775918050075416428527708162011350246806058163276171676765260937528056844214486193960499834472806721906670417240094234466197812426690787535944616698508064636137166384049029219341881909581659524477861846140912878298438431703248173428886572737663146519104988029447960814673760503957196893714671801375619055462996814764263903953007319108169802938509890062166509580863811000557423423230896109004106619977392256259918212890625\n\n_AUTOMORPHICS = [0, 1] + sorted(set(chain.from_iterable((_A018247 % 10 ** i, 10 ** i + 1 - _A018247 % 10 ** i) for i in range(1, 2780))))\n\ngreen = _AUTOMORPHICS.__getitem__'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

_target = None
_fn_name = 'green'
if _fn_name:
    if "Solution" in ns:
        try:
            _obj = ns["Solution"]()
            if hasattr(_obj, _fn_name):
                _target = getattr(_obj, _fn_name)
        except Exception:
            _target = None
    if _target is None and _fn_name in ns and callable(ns[_fn_name]):
        _target = ns[_fn_name]
# Fallback: if there's exactly one user-defined function, use it
if _target is None:
    _cands = [v for k, v in ns.items() if callable(v) and getattr(v, "__module__", "") in ("__judge__", "__main__")]
    _user_funcs = [c for c in _cands if getattr(c, "__name__", "").startswith("_") is False]
    if len(_user_funcs) == 1:
        _target = _user_funcs[0]
if _target is None:
    raise RuntimeError(f"Could not resolve callable '{_fn_name}'")

_raw = sys.stdin.read().strip()
if _raw:
    _parsed = json.loads(_raw)
    if isinstance(_parsed, dict):
        _kwargs = _parsed.get("kwargs", {})
        _args = _parsed.get("args", [])
    else:
        _args, _kwargs = _parsed, {}
else:
    _args, _kwargs = [], {}
if not isinstance(_args, (list, tuple)):
    _args = [_args]
_res = _target(*_args, **_kwargs)
try:
    sys.stdout.write(repr(_res) + "\n")
except Exception:
    pass

```

Measured memory_bytes: 5260