Add new column based in condition

At begining of column 2 the same block (2000) have 3 lines, in the next block (2336) it have 9 lines and for block (2524) 3 lines.

In block (2336) which contend more than 3 lines. The value increase for column 1 is every 2, but when it is > 36. Then, from 3601 to 33607 (lower values) value in column 3 = S3 and for 34033 to 34041 (higher values) value in column 3 = S2

In the orignal file i have thousands of lines.

At beginning some blocks in column 2 will contends 3 lines, then value in column 3 = S2.
In the middle blocks will contend more than 3 line. Here we need to apply the condition. (lower values in column1) value in column 3 = S3, (higher values in column1) value in column 3 = S2
At the end blocks in column 2 will contends 3 lines, then value in column 3 = S3.

Input file
30001 2000
30003 2000
30005 2000
30007 2005
30009 2005
30011 2005
33601 2336
33603 2336
33605 2336
33607 2336
34033 2336
34035 2336
34037 2336
34039 2336
34041 2336
33609 2339
33611 2339
33613 2339
34043 2339
34045 2339
34047 2339
34049 2339
35857 2524
35859 2524
35861 2524
35855 2527
35857 2527
35869 2527

Output desired

30001 2000 S2
30003 2000 S2
30005 2000 S2
30007 2005 S2
30009 2005 S2
30011 2005 S2
33601 2336 S3
33603 2336 S3
33605 2336 S3
33607 2336 S3
34033 2336 S2
34035 2336 S2
34037 2336 S2
34039 2336 S2
34041 2336 S2
33609 2339 S3
33611 2339 S3
33613 2339 S3
34043 2339 S2
34045 2339 S2
34047 2339 S2
34049 2339 S2
35857 2524 S3
35859 2524 S3
35861 2524 S3
35855 2527 S3
35857 2527 S3
35869 2527 S3

I tried

awk '$3<0{c=3} {$3=(c-->0)?"S3":"S2"}1' tmp1 | tac | awk 'NR<=36 {$NF="S3"}1' | tac | awk '{print $2$1,$3}'

Thanks in advance :b: