This file is indexed.

/usr/share/singular/LIB/gradedModules.lib is in singular-data 4.0.3+ds-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
//////////////////////////////////////////////////////////////////////////
version="version gradedModules.lib 4.0.1.1 Jan_2015 "; // $Id: e400e25eb0c8c5acc597207025d0a22e1143469d $
category="Commutative Algebra";
info="
LIBRARY: gradedModules.lib     Operations with graded modules/matrices/resolutions
AUTHORS:  Oleksandr Motsak <U@D>, where U=motsak, D=mathematik.uni-kl.de
@*        Hanieh Keneshlou <hkeneshlou@yahoo.com>
KEYWORDS: graded modules, graded homomorphisms, syzygies
OVERVIEW:
    The library contains several procedures for constructing and manipulating graded modules/matrices/resolutions.
    Basics about graded objects can be found in [DL].
    Throughout this library graded objects are graded maps, that is,
    matrices with polynomials, together with grading weights for source and
    destination. Graded modules are implicitly given as coker of a graded map.
    Note that in special cases we may also consider submodules in S^r generated
    by columns of a graded polynomial matrix (or a graded map).
NOTE:
    set assumeLevel to positive integer value in order to auto-check all assumptions.
    We denote the current basering by S.
REFERENCES:
[DL] Decker, W., Lossen, Ch.: Computing in Algebraic Geometry, Springer, 2006
PROCEDURES:
    grobj(M,w[,d])  construct a graded object (map) given by matrix M
    grtest(A)       check whether A is a valid graded object
    grdeg(M)        compute graded degrees of columns of the map M
    grview(M)       view the graded structure of map M
    grshift(M,d)    shift graded module coker(M) by +d
    grzero()        presentation of S(0)^1
    grtwist(r,d)    presentation of S(d)^r
    grtwists(v)     presentation of S(v[1])+...+S(v[size(v)])
    grsum(M,N)      direct sum of two graded modules coker(M) + coker(N)
    grpower(M,p)    direct p-th power of graded module coker(M)
    grtranspose(M)  un-ordered graded transpose of map M
    grgens(M)       try to compute submodule generators of coker(M)
    grpres(F)       presentation of submodule generated by columns of F
    grorder(M)      reorder cols/rows of M for correct graded-block-structure
    grtranspose1(M)  reordered graded transpose of map M
    TestGRRes(n,I)  compute/order/transpose a graded resolution of ideal I
    KeneshlouMatrixPresentation(v)  build some presentation with intvec v
    grsyz(M)        syzygy of Im(M)
    grres(M,l[,m])  resolution of Im(M) of length l... minimal?
    grlift(A,B)     graded lift, gens!
    grprod(A,B)     composition of graded maps (product of matrices?)
    grgroebner(M)   Groebner Basis of Im(M) as a graded object
    grconcat(M,N)   sum of maps into the same target module
    grrndmat(s,d[,p,b])   generate random matrix compatible with src and dst gradings
    grrndmap(S,D[,p,b])   generate random 0-deg homomorphism src(S) -> src(D)
    grrndmap2(S,D[,p,b])   generate random 0-deg homomorphism dst(S) -> dst(D)
    grlifting(A,B)     RND! chain lifting
    grlifting2(A,B)    RND! chain lifting
    mappingcone(M,N)   mapping cone?
    grlifting3(A,B)    RND! chain lifting? probably wrong one
    mappingcone3(A,B)  mapping cone3?
    grrange(M)         get the row-weightings
    grneg(A)           graded object given by -A
    matrixpres(a)      matrix presentation of direct sum of Omega^{a[i]}(i)
";

//    grisequal(A,B)  check whether A is exactly eqal to B? TODO: isomorphic!

LIB "matrix.lib"; // ?

//////////////////////////////////////////////////////////////////////////////////////////////////////////
// . view graded module/map
// . reorder graded resolution
// . transpose graded module/map?

// draw helpers
static proc repeat(int n, string c) { string r = ""; while( n > 0 ){ r = r + c; n--; } return(r); }
static proc pad(int m, string s, string c){ string r = s; while( size(r) < m ){ r = c + r; } return(r); }
static proc mstring( int m, string c){ if( m < 0 ) { return (c); }; return (string(m)); }

static proc grsumstr(string R, intvec v)
"direct sum_i=1^size R(-v[i]), for source and targets of graded objects"
{
  int n = size(v);
  if (n == 0) { return ("0"); }
  ASSUME(0, n > 0 );

  if (R == "")
  {
    R = nameof(basering);
  }

  ASSUME(0, defined(R) && (R != "") );

  v = -v; // NOTE: due to Mathematical meanings of Singular data


  int lst = v[1];
  int cnt = 1;

  string p = R;
  if( lst != 0 ) { p = p + "(" + string(lst) + ")"; }

  int k, d;
  for (k = 2; k <= n; k++ )
  {
    d = v[k];
    if( d == lst ) { cnt = cnt + 1; }
    else
    {
      if (cnt > 1){ p = p + "^" + string(cnt); }

      cnt = 1; lst = d;

      p = p + " + " + R;
      if( lst != 0 ) { p = p + "(" + string(lst) + ")"; }
    }
  }
  if (cnt > 1){ p = p + "^" + string(cnt); }

  return (p);
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  def E = grtwist(2, 0);
  def v = grrange(E); // grdeg(E);
  grsumstr("", v );
}

// view helper
static proc draw ( intmat D, int d )
{
//  print(D); return ();
  int nc = ncols(D); int nr = nrows(D);
  int s, r, c; int max = 0;
  // get maximum string-length among all {D[r,c]}
  for (r = nr; r > 0; r-- ) { for (c = nc; c > 0; c-- ) { s = size( string(D[r, c]) ); if( max < s ) { max = s; } } }
  max = max + 1;
  string head = ""; string foot = ""; string middle = "";
  for ( c = d+1; c < (nc-d); c++ )
  {
    head = head + pad(max, string(D[1 , c]), ".") + " ";
    foot = foot + pad(max, string(D[nr, c]), " ") + " ";
  }
  // last head/foot enties:
  head = head + pad(max, string(D[1 , c]), ".");
  foot = foot + pad(max, string(D[nr, c]), " ");
  // head/foot dash lines:
  string dash  = "-"; string dash2  = "=";
  dash = repeat( (nc - 2*d) - 1 , repeat(max, dash) + " " ) + repeat(max, dash) + " "; // dash  = repeat( (max + 1) * (nc - 2*d) , dash );
  dash2 = repeat( (nc - 2*d) - 1 , repeat(max, dash2) + " " ) + repeat(max, dash2) + " "; // dash2 = repeat( (max + 1) * (nc - 2*d) , dash2);
  for ( r = d+1; r <= (nr-d); r++ )
  {
    middle = middle + pad(max, string(D[r,1]), " ") + " :";
    for ( c = d+1; c < (nc-d); c++ ) { middle = middle + pad(max, mstring(D[r,c], "-"), " ") + " "; }
    middle = middle + pad(max, mstring(D[r,nc-d], "-"), " ") + " |" + pad(max, string(D[r,nc]), ".") + newline;
  }
  string corner_id = repeat(max, ".");
  string corner = repeat(max, " ");
  // print everything all at once:
  print                                     (
      corner + "  " + head  + " ." + corner_id + newline +
      corner + "  " + dash  + "+"  + corner_id + newline +
                      middle                          +
      corner + "  " + dash2 + " "  + corner + newline +
      corner + "  " + foot +  "  " + corner );
}

proc grview(N)
"USAGE:  grview(M), graded object M
RETURN:  nothing
PURPOSE: print the degree/grading data about the GRADED matrix/module/ideal/mapping object M
ASSUME:  M must be graded
EXAMPLE: example grview; shows an example
"
{
//  if( size(N) == 0 ) { return (); }
  string msg = "Graded";
  string lst;

  string arrow = " <- ";
  string R = nameof(basering);

  if( typeof( N ) == "list" ) // TODO: find a better DS for graded resolutions / chain map !?
  {
    int n = size(N); ASSUME(0, n > 0);

    string msg1 = "";
    if( size(R) >= 2 )
    {
      msg1 = msg1 + "(let R:="+R+")";
      R = "R"; // !!!
    }
    msg1 = msg1 + ": " ;



    list arr; arr[n] = list();
    int exact = (1==1);

    int i = 1;

    ASSUME(1, grtest(N[i]));

    string dst = grsumstr(R, grrange(N[i]));
    string src = grsumstr(R, grdeg(N[i]));

    arr[i] = list(dst,  src);

    i = i + 1;

    while( i <= n )
    {
      ASSUME(1, grtest(N[i]));

      dst = grsumstr(R, grrange(N[i]));

      if( exact && (src != dst) )
      {
//        "src: [" + src+ "] != [" + dst + "] :(!!";
        exact = (1==0);
      }

      src = grsumstr(R, grdeg(N[i]));

      arr[i] = list(dst,  src);

      i = i + 1;
    };

    string o = "";

    if( exact )
    { // complex?
      msg = msg + " resolution" + msg1;

      o = "d";

      for( i = 1; i <= n; i++ )
      {
        msg = msg + newline + arr[i][1] + " <-- "+o+"_" + string(i) + " --";
      };

      msg =  msg + newline + arr[n][2];
      msg = msg + ", given by maps: ";
    } else
    {
//      print(arr);

      msg = msg + "-object collection";
      o = "o";

//      for( i = 1; i <= n; i++ )
//      {
//        msg = msg + newline + arr[i][1] + " <-- "+o+"_" + string(i) + " -- " + arr[i][2];
//      };
      msg = msg + ", given by the following maps (named here as "+o+"_[1 .. "+string(n)+"]): ";
    }


    print(msg);

    for( i = 1; i <= size(N); i++ )
    {
      print( o+"_" + string(i) + " :" );
      grview( N[i] );
    };

    return ();
  }

//  typeof( N ) ;  attrib( N );  grrange(N);

  ASSUME(1, grtest(N) );

  msg = msg + " homomorphism";
  if( size(R) >= 2 )
  {
    msg = msg + "(let R:="+R+")" ;
    R = "R";
  }

  msg = msg + ": ";

  intvec gr = grrange(N); // grading weights?
  string dst = grsumstr(R, gr);

  intvec G = grdeg(N);
  string src = grsumstr(R, G);

  if( ncols(N) == 0 )
  {
    src = "0";
  }

  lst = msg;

  if( (size(lst) + size(dst) + size(src) + 4) > 80 )
  {
    if( (size(lst) + size(dst)) > 80 ) { msg = msg + newline; lst = ""; }

    msg = msg + dst + arrow;
    lst = lst + dst + arrow;

    if( (size(lst) + size(src)) > 80 ) { msg = msg + newline; lst = ""; }

    msg = msg + src;
    lst = lst + src;
  } else
  {
    msg = msg + dst + arrow + src;
    lst = lst + dst + arrow + src;
  }

  if( size(lst) > 70 ) { msg = msg + newline; } // lst = "";
  msg = msg + ", given by ";
//  lst = lst + ", given by ";


  int nc = ncols(N); int nr = nrows(N);

  if( size(N) == 0 )
  {
    msg = msg + "zero ("+ string(nr);
    if( nr == nc ) { msg = msg + "^2"; } else { msg = msg + " x " + string(nc); }
    print( msg+") matrix." );
  } else
  {
    ASSUME(0, nc > 0);

    matrix M = module(N);

    int r,c;
    int d = 1; // number of extra cols/rows for extra info around the central degree(N) block in D
    intmat D[nr+2*d][nc+2*d];

    for( c = nc; c > 0; c-- )
    {
      D[1, c+d] = c; // top row indeces
      D[nr+2*d, c+d] = G[c]; // deg(v) + gr[ leadexp(v)[m] ]; // bottom row with computed column induced degrees
    }

    for( r = nr; r > 0; r-- )
    {
      D[r+d, 1] = gr[r]; // left-most column with grading data
      for( c = nc; c > 0; c-- )
      {
        D[r+d, c+d] = deg(M[r, c]); // central block with degrees (-1 means zero entry)
      }
      D[r+d, nc+2*d] = r; // right-most block with indeces
    }

    if( nr == nc) // square matrix // detect diagonal?
    {
      for (c = nr; c > 0; c-- )
      {
        M[c,c] = 0;
      }

      if( size(module(M)) == 0 )
      {
        msg = msg + "a diagonal matrix";
      } else
      {
        msg = msg + "a square matrix";
      }

    } else
    {
      msg = msg + "a matrix";
    }

    print(msg + ", with degrees: " );
    draw(D, d); // print it nicely!
  }
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module A = grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,1) );
  grview(A);

  module B = grobj( module([0,x,y]), intvec(15,1,1) );
  grview(B);

  module D = grsum( grsum(grpower(A,2), grtwist(1,1)), grsum(grtwist(1,2), grpower(B,2)) );
  grview(D);

  ring R = 0,(w,x,y,z), dp; def I = grobj( ideal(y2-xz, xy-wz, x2z-wyz), intvec(0) );
  list res1 = grres(I, 0); // non-minimal
  grview(res1);
  print(betti(res1,0), "betti");

  list res2 = grres(grshift(I, -10), 0, 1); //  minimal!
  grview(res2);
  print(betti(res2,0), "betti");
}

static proc issorted( intvec g, int s )
{
  g = s * g; //  "g: ", g;
  int i = size(g);

  for(; i > 1; i--)
  {
    if( (g[i] - g[i-1]) < 0 )
    {
      return (0);
    }
  }

  return (1);
}

static proc mysort( intvec gr, int s )
"
computes the permutation P of gr, such that (s*gr)[P] is ascendingly sorted
NOTE: looks like a bubble sort (was taken from sort) and modified to ensure stability!
TODO: replace with some kernel function if this turns out to be inefficient!!
"
{
  gr = s * gr;
  int m = size(gr);
  intvec pivot;

  int Bi;
  // compute reordering permutation pivot such that gr[pivot] is (stably) sorted
  for(Bi=m; Bi>0; Bi--) { pivot[Bi]=Bi; } // pivot = Id_m for starters

  int Bn,Bb; int P, D;

  int Bj = 0; int flag = 0;

  // Bi == 0
  while(Bj==0)
  {
    Bi++; Bj=1;
    for(Bn=1; Bn <= (m-Bi); Bn++)
    {
      D = (gr[pivot[Bn]] - gr[pivot[Bn+1]]); // sort gr
      P = (D > 0) or ( (D == 0) && ((pivot[Bn]-pivot[Bn+1]) > 0) ); // stability!?
      if(P)
      {
        Bb=pivot[Bn];
        pivot[Bn]=pivot[Bn+1];
        pivot[Bn+1]=Bb;

        Bj=0; flag = 1;
      }
    }
  }

  ASSUME(1, issorted(intvec(gr[pivot]), 1));

  return (pivot);
}

proc grdeg(M)
"USAGE:  grdeg(M), graded object M
RETURN:  intvec of degrees
PURPOSE: graded degrees of columns (generators) of M, describing the source of M
ASSUME:  M must be a graded object (matrix/module/ideal/mapping)
NOTE:    if M has zero cols it shoud have attrib(M,'degHomog') set.
EXAMPLE: example grdeg; shows an example
"
{
  ASSUME(1, grtest(M) );

  if ( typeof(attrib(M, "degHomog")) == "intvec" )
  {
    def t = attrib(M, "degHomog"); // graded degrees

    if( size(t) == 0 ){ return (t); } // ZERO!

    ASSUME(2, ncols(M) == size(t) );
    return (t);
  }

  if( ncols(M) == 0 ) { return (0:0); } // FIXME: Why???

  ASSUME(0, ncols(M) > 0);
  ASSUME(0, ncols(M) == size(M) );

  def w = grrange(M); // grading weights?

  if( size(M) == 0 ){ return (w); } // TODO: Q@Wolfram!???

  int m = ncols(M); // m > 0 in Singular!
  int n = nvars(basering) + 1; // index of mod. column in the leadexp

  module L = lead(M[1..m]); // leading module-terms for input column vectors
  intvec d = deg(L[1..m]); // their degrees
  intvec c = leadexp(L[1..m])[n]; // their module-components

//   w = intvec(-6665), w; // 0?????
  intvec gr = w[c]; //  + 1]; // weights?????

  gr = gr + d; // finally we compute their graded degrees

  return (gr);
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module A = grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,1) );
  grview(A);

  module B = grobj( module([0,x,y]), intvec(15,1,1) );
  grview(B);

  module D = grsum(
                   grsum(grpower(A,2), grtwist(1,1)),
                   grsum(grtwist(1,2), grpower(B,2))
                  );

  grview(D);
  grdeg(D);

  def D10 = grshift(D, 10);

  grview(D10);
  grdeg(D10);
}

static proc reorder(def M, int s)
"
Reorder gens of M: compute graded degrees and the permutation to sort them
"
{
  // input should be graded:
  ASSUME(1, grtest(M) );

  intvec w = grrange(M); // grading weights

  intvec gr = grdeg( M );

//  intvec d = deg(M[1..nocls(M)]); // no need to deal with un-weighted degrees??!

  intvec pivot = mysort(gr, s);

  // grades & ordering permutation for N.  gr[pivot] should be sorted!
  ASSUME(1, issorted(gr[pivot], s));

  module N = grobj(module(M[pivot]), w, intvec(gr[pivot]));  // reorder the starting ideal/module

//  "reorder: "; grview(N);

  return (N, intvec(gr[pivot]));
}

proc grtranspose1(def M)
"USAGE:  grtranspose1(M), graded object or list M
RETURN:  same as input
PURPOSE: graded transpose of graded object or chain complex M
ASSUME:  M must be a graded object or a list of graded objects
EXAMPLE: example grtranspose1; shows an example
"
{
  if( typeof( M ) == "list" )
  {
    if( size(M) == 0 ) { return (); }

    int j = size(M);

    int i = 1;

    // TODO: extra grading argument???
    while( i < j )
    {
     if( size(M[i]) == 0 ){ break; }
     ASSUME(0, typeof(grrange(M[i])) == "intvec");
     i++;
    }

    if( size(M[i]) == 0 ) { i--; }

    j = i; i = 1;

    list L;
    while( j > 0 )
    {
//      grview(M[i]);
      L[j] = grtranspose1( grobj( M[i], grrange(M[i])) );
//      grview(L[j]);

      if( (i > 1) && (j > 0) )
      {
//        grview(L[j+1]);
        ASSUME(2, size( module( matrix(L[j])*matrix(L[j+1]) ) ) == 0 );
      };
//      grview(L[j]);
      j--; i++;
    };
    return (L); // ?
  }

//////
// "a";  grview(M);
  ASSUME(1, grtest(M) );

 intvec d; module N;

 (N,d) = reorder(M, -1);

 kill M; module M = grobj(transpose(N), -d, -grrange(N));

// "b";  grview(M);

 kill N,d; module N; intvec d;
 // reverse order:
 (N,d) = reorder(M, 1); kill M;

// "e"; grview( N );

 ASSUME(1, issorted( grrange(N), 1) );
 ASSUME(1, issorted(grdeg(N), 1) );


 return (N);
}
example
{ "EXAMPLE:"; echo = 2;

  "Surface Name: 'k3.d10.g9.quart2' in P^4";
  int @p=31991; ring R = (@p),(x,y,z,u,v), dp;
  ideal J = x3yz2+31/15x2y2z2-7231xy3z2+99/37y4z2+28/95x3z3+97/32x2yz3+13247xy2z3+12717y3z3-113/31x2z4-61/30xyz4-6844y2z4+104/3xz5-13849yz5+43/39z6+13061x3yzu-8463x2y2zu+94/69xy3zu-8/61y4zu-13297x3z2u+7217x2yz2u-7830xy2z2u-75/14y3z2u+2839x2z3u-14657xyz3u-52/7y2z3u-6/89xz4u-6169yz4u+44/7z5u-98/33x3yu2+41/30x2y2u2-65/98xy3u2+122/13y4u2+9906x3zu2-11587x2yzu2+17/53xy2zu2+6504y3zu2+49/106x2z2u2+11480xyz2u2+97/71y2z2u2+12560xz3u2-114/83yz3u2-13761z4u2-67/112x3u3-18/49x2yu3+21/67xy2u3-44/43y3u3+123/116x2zu3+4459xyzu3-13841y2zu3-805xz2u3-1382yz2u3-5293z3u3+133x2u4-122/79xyu4+9724y2u4+61/24xzu4+113/119yzu4-19/108z2u4+15893xu5+57/22yu5+4600zu5-618u6-27/53x3yzv+44/103x2y2zv-142xy3zv+19/84y4zv+105/8x3z2v+10532x2yz2v-75/74xy2z2v-70/19y3z2v+31/80x2z3v-481xyz3v+47/30y2z3v+14318xz4v+51/28yz4v-15/113z5v-46/17x3yuv-99/100x2y2uv-106/5xy3uv+14384y4uv+7/100x3zuv-15/64x2yzuv-6976xy2zuv+12051y3zuv-67/42x2z2uv-2627xyz2uv-49/104y2z2uv+77/16xz3uv+15766yz3uv+85/117z4uv-107/101x3u2v-6699x2yu2v+2443xy2u2v-27/28y3u2v+11945x2zu2v-14467xyzu2v-4873y2zu2v-63/124xz2u2v-8270yz2u2v+11900z3u2v+47/14x2u3v+53/8xyu3v-10/51y2u3v-87/119xzu3v+114/73yzu3v+86/57z2u3v+52/63xu4v-11587yu4v+1/18zu4v-121/109u5v+116/11x3yv2+19/108x2y2v2-31/3xy3v2-43/9y4v2-81/100x3zv2-7728x2yzv2-1037xy2zv2+24/101y3zv2-61/103x2z2v2-8/51xyz2v2+117/109y2z2v2+98/23xz3v2+1646yz3v2-3356z4v2+105/59x3uv2+117/31x2yuv2+519xy2uv2+12633y3uv2+25/6x2zuv2-963xyzuv2-49/23y2zuv2-116/25xz2uv2+14146yz2uv2+11480z3uv2-95/8x2u2v2-10928xyu2v2-51/23y2u2v2-12770xzu2v2-92/91yzu2v2+3872z2u2v2+3183xu3v2+6871yu3v2+90/37zu3v2+10019u4v2-69/88x3v3-1398x2yv3-97/72xy2v3-46/97y3v3+107/14x2zv3-20/89xyzv3-11367y2zv3+120/29xz2v3-86/81yz2v3+107/69z3v3-39/17x2uv3+83/11xyuv3+169y2uv3-11/71xzuv3-22/17yzuv3-14862z2uv3-13009xu2v3-101/12yu2v3+10617zu2v3+2567u3v3-23/85x2v4+27/50xyv4+113/51y2v4+97/16xzv4+4438yzv4-11857z2v4+14580xuv4-6426yuv4+9421zuv4-10585u2v4+14670xv5+1807yv5+10298zv5-116/53uv5+7869v6,x3yzu+31/15x2y2zu-7231xy3zu+99/37y4zu+28/95x3z2u+97/32x2yz2u+13247xy2z2u+12717y3z2u-113/31x2z3u-61/30xyz3u-6844y2z3u+104/3xz4u-13849yz4u+43/39z5u-124/43x3yu2-90/13x2y2u2-13244xy3u2-78/73y4u2+118/43x3zu2+37/67x2yzu2-10426xy2zu2+2412y3zu2-32/113x2z2u2+35/104xyz2u2+3952y2z2u2+9028xz3u2-1990yz3u2-59/109z4u2+15499x3u3+116/23x2yu3+95/58xy2u3+8/47y3u3+59/109x2zu3-29xyzu3+12412y2zu3+20/81xz2u3+2200yz2u3-13809z3u3+3889x2u4-8136xyu4+8922y2u4-4/121xzu4+82/113yzu4-65/23z2u4+101/53xu5+103/113yu5-99/118zu5-9524u6-2749x3yzv-7814x2y2zv+73/113xy3zv+9937y4zv-59/62x3z2v-23/12x2yz2v-10245xy2z2v+7130y3z2v-4427x2z3v+6656xyz3v+3448y2z3v-46/79xz4v+1611yz4v+8453z5v+12013x3yuv+49/17x2y2uv-4/115xy3uv-121/91y4uv-63/29x3zuv+64/7x2yzuv-8785xy2zuv-87/14y3zuv+36/121x2z2uv+9525xyz2uv+4215y2z2uv-17/13xz3uv-117/125yz3uv+101/122z4uv+42/37x3u2v-8747x2yu2v-105/79xy2u2v+10799y3u2v-58/49x2zu2v-8/75xyzu2v-67/49y2zu2v-38/11xz2u2v+53/27yz2u2v+113/52z3u2v+18/59x2u3v+71/106xyu3v+47/2y2u3v-4594xzu3v+95/4yzu3v-121/46z2u3v-55/62xu4v-101/72yu4v+40/53zu4v+15227u5v-15553x3yv2+29/94x2y2v2-4076xy3v2-7133y4v2+27/125x3zv2+33/29x2yzv2-63/95xy2zv2+9166y3zv2-480x2z2v2+9941xyz2v2+107/46y2z2v2+13018xz3v2+53/98yz3v2+92/35z4v2+17/30x3uv2+77/95x2yuv2+11/67xy2uv2+8262y3uv2+65/11x2zuv2+2567xyzuv2-33/94y2zuv2+85/92xz2uv2+103/25yz2uv2-27/100z3uv2+13210x2u2v2-109/90xyu2v2+141y2u2v2-124/51xzu2v2-3/109yzu2v2-4910z2u2v2+205xu3v2+14357yu3v2+85/57zu3v2-109/28u4v2-68/39x3v3+10545x2yv3-2176xy2v3-8743y3v3+15111x2zv3+25/119xyzv3+8/103y2zv3-6046xz2v3+8658yz2v3+106/5z3v3-31/126x2uv3-7762xyuv3+2315y2uv3+124/67xzuv3-77/104yzuv3+95/71z2uv3+69/119xu2v3+13069yu2v3-8620zu2v3+105/41u3v3-15772x2v4-11212xyv4-61/36y2v4+38/125xzv4-15860yzv4+8/63z2v4+7519xuv4-94/41yuv4+45/32zuv4+9417u2v4-71/35xv5-6287yv5+6481zv5+106/99uv5+3/41v6,-8036x3yu2+7966x2y2u2-151xy3u2-14/111y4u2-111/76x3zu2-102/11x2yzu2+7956xy2zu2-7397y3zu2-113/16x2z2u2-8049xyz2u2+7230y2z2u2+3978xz3u2-36/113yz3u2-8147z4u2-107/83x3u3+78/97x2yu3+12700xy2u3+11/72y3u3+88/31x2zu3-63/40xyzu3+101/35y2zu3-220xz2u3+3/103yz2u3-49/45z3u3-21/113x2u4+104/123xyu4+98/47y2u4-56/61xzu4-87/50yzu4+5913z2u4-120/17xu5+64/11yu5-109/80zu5+10371u6-118/25x3yzv+58/99x2y2zv-5/64xy3zv+7/46y4zv-49/103x3z2v-77/106x2yz2v-44/7xy2z2v-7559y3z2v-17/35x2z3v+948xyz3v-15043y2z3v-3576xz4v-2/109yz4v+74/11z5v+6436x3yuv+7316x2y2uv+29/5xy3uv-1326y4uv+34/49x3zuv-122/27x2yzuv-632xy2zuv+46/49y3zuv-13463x2z2uv-808xyz2uv-17/32y2z2uv-13149xz3uv-117/88yz3uv-45/79z4uv-65/94x3u2v+6/67x2yu2v+34/39xy2u2v-14026y3u2v+42/107x2zu2v-3287xyzu2v-70/43y2zu2v+29/104xz2u2v-47/18yz2u2v-11038z3u2v+6262x2u3v-5255xyu3v-7/10y2u3v+7065xzu3v+5608yzu3v+4675z2u3v-73/90xu4v-15822yu4v-71/63zu4v+110/97u5v-69/5x3yv2+4315x2y2v2-124/45xy3v2-79/16y4v2-10739x3zv2-93/46x2yzv2+12499xy2zv2-73/86y3zv2+6367x2z2v2-12876xyz2v2-306y2z2v2-89xz3v2-70/51yz3v2+13120z4v2+61/57x3uv2+14782x2yuv2-91/9xy2uv2-2625y3uv2+14747x2zuv2-5899xyzuv2-12944y2zuv2-47/14xz2uv2-4551yz2uv2-99/101z3uv2-12618x2u2v2+1507xyu2v2-11951y2u2v2+68/49xzu2v2+49/39yzu2v2-56/103z2u2v2-31/85xu3v2-32/49yu3v2-65/14zu3v2+15/7u4v2+5749x3v3-3667x2yv3-107/29xy2v3+11301y3v3+95/18x2zv3-121/74xyzv3+75/26y2zv3+101/98xz2v3-111/76yz2v3-11335z3v3-15923x2uv3-36/83xyuv3-4134y2uv3-87/118xzuv3-41/11yzuv3+104/61z2uv3+12583xu2v3-50/23yu2v3-31/44zu2v3-29/23u3v3+108/107x2v4-8216xyv4-5009y2v4+101/26xzv4-9779yzv4+71/74z2v4-3358xuv4+83/84yuv4-34/39zuv4+44/47u2v4-112/83xv5+113/74yv5+82/79zv5-115/99uv5+12/109v6,-x4y-31/15x3y2+7231x2y3-99/37xy4-28/95x4z-53/107x3yz-4623x2y2z+5300xy3z-41/111y4z+12205x3z2+113/120x2yz2+54/49xy2z2-85/63y3z2+104/89x2z3-52/121xyz3-22/49y2z3+14367xz4+71/93yz4+55/56z5-5/81x4u-67/81x3yu-83/13x2y2u+98/55xy3u+15289y4u-94/111x3zu+40/29x2yzu-16/59xy2zu-107/14y3zu+2965x2z2u-459xyz2u-2/47y2z2u+35/22xz3u+119/39yz3u-12180z4u-13679x3u2+1534x2yu2+11305xy2u2-62/9y3u2-68/39x2zu2+11/90xyzu2-36/101y2zu2-2896xz2u2-15114yz2u2-49/114z3u2+19/16x2u3-11401xyu3-109/3y2u3+67/80xzu3+53/92yzu3+2894z2u3+119/74xu4+407yu4-65/53zu4+95/94u5-9309x4v+21/40x3yv+1436x2y2v+2194xy3v+6994y4v-116/81x3zv+13/2x2yzv-12/13xy2zv-23/84y3zv-61/83x2z2v+2023xyz2v+19/40y2z2v+43/26xz3v-59/113yz3v-47/53z4v+15580x3uv+21x2yuv+113/97xy2uv-15419y3uv-15243x2zuv+5128xyzuv-34/47y2zuv+13206xz2uv-4833yz2uv+107/91z3uv-1693x2u2v+54/53xyu2v-86/67y2u2v+98/9xzu2v+86/17yzu2v+64/89z2u2v+25/113xu3v+7884yu3v+14089zu3v-12027u4v-9471x3v2-36/85x2yv2-21/13xy2v2+15888y3v2+76/109x2zv2+4547xyzv2+115/12y2zv2-11/107xz2v2+6764yz2v2-8321z3v2+84/101x2uv2-202xyuv2+3251y2uv2+91/4xzuv2+7124yzuv2-53/81z2uv2+47/84xu2v2-8833yu2v2+117/14zu2v2-3/113u3v2+126/97x2v3-78/115xyv3+68/63y2v3-34/109xzv3+5913yzv3+6226z2v3-2365xuv3+91/120yuv3+14120zuv3-69/8u2v3+71/12xv4-13094yv4-7262zv4-33uv4+5367v5,-9533x4y-318x3y2+8/49x2y3+83/29xy4+13129y5+221x4z+115/48x3yz+12508x2y2z+97/52xy3z+11479y4z+8941x3z2+104/109x2yz2+9191xy2z2+103/64y3z2+10584x2z3-7728xyz3+3979y2z3+15/82xz4+5409yz4-1326z5+3756x4u-57/62x3yu+63/47x2y2u-14600xy3u+159y4u-11/4x3zu-113/57x2yzu-26/125xy2zu-32/87y3zu-10/21x2z2u+12927xyz2u-73/62y2z2u+115/99xz3u-13/3yz3u-126/25z4u-3969x3u2-122/57x2yu2-5003xy2u2-100/117y3u2-71/30x2zu2+7356xyzu2-2211y2zu2+31/40xz2u2-6722yz2u2-139z3u2+4426x2u3+1/115xyu3-72/85y2u3+15260xzu3+7938yzu3+4/115z2u3-33/89xu4+31/108yu4-50/83zu4+14/107u5+24/95x4v-113/17x3yv+81/14x2y2v-9957xy3v-10075y4v-122/113x3zv+65/118x2yzv-96/29xy2zv-19/41y3zv+113/35x2z2v+121/31xyz2v-9/68y2z2v+91/45xz3v-23/116yz3v-67/99z4v-5355x3uv-3112x2yuv-12824xy2uv-58/123y3uv-13/22x2zuv-19/85xyzuv-121/24y2zuv-14093xz2uv+99/95yz2uv+89/50z3uv+13096x2u2v-109/120xyu2v+121/61y2u2v+80/41xzu2v-39yzu2v-8/99z2u2v+5/17xu3v+112/69yu3v+14346zu3v-7173u4v+125/13x3v2+43/53x2yv2-78/103xy2v2-109/111y3v2+33/13x2zv2-15333xyzv2+87/49y2zv2-7212xz2v2+7729yz2v2-86/123z3v2-119/103x2uv2-71/122xyuv2-81/113y2uv2+6133xzuv2+55/72yzuv2+69/31z2uv2+12828xu2v2+94/15yu2v2-7588zu2v2+21/41u3v2-8712x2v3+74/9xyv3-11/87y2v3+1446xzv3-3/95yzv3-87/55z2v3-717xuv3-110/97yuv3-13/113zuv3-95/81u2v3-37/68xv4+5112yv4-56/11zv4-6/115uv4+7910v5,25/42x4y-42/79x3y2-59/21x2y3+2736xy4-107/115x4z-203x3yz+47/101x2y2z+7686xy3z-63/64y4z+103/57x3z2-12082x2yz2+11/102xy2z2-83/43y3z2+13/49x2z3-2685xyz3+123/44y2z3+31/12xz4+126/83yz4+14745z5+83/37x4u+7362x3yu-14615x2y2u-14109xy3u+49/47y4u+1929x3zu+83/71x2yzu-13640xy2zu-97/58y3zu-11141x2z2u-61/49xyz2u-3745y2z2u-74/21xz3u+3493yz3u-7540z4u-103/118x3u2-43/32x2yu2-9200xy2u2-23/65y3u2+15895x2zu2-13924xyzu2-14291y2zu2-11039xz2u2-31/37yz2u2-101/93z3u2-39/83x2u3-4536xyu3-78/47y2u3+75/44xzu3-24/121yzu3-81/113z2u3-81/89xu4+15825yu4-4111zu4+5850u5-12534x4v-69/94x3yv-10076x2y2v+3952xy3v+25/12y4v+21/34x3zv+11002x2yzv-54xy2zv+20/23y3zv+4991x2z2v+549xyz2v+2687y2z2v-110/9xz3v+11359yz3v+49/24z4v+62/107x3uv-27/41x2yuv-17/52xy2uv-10972y3uv+12/103x2zuv-318xyzuv-77/40y2zuv-114/53xz2uv+17/28yz2uv-8084z3uv+85/36x2u2v+7/100xyu2v-5772y2u2v-89/114xzu2v-40/121yzu2v+3340z2u2v+36/113xu3v-38/93yu3v+2519zu3v-7084u4v+8136x3v2-55/23x2yv2+27/7xy2v2+74/39y3v2+63/16x2zv2-8661xyzv2+2/91y2zv2+3773xz2v2-75/122yz2v2+447z3v2-59/109x2uv2-119/9xyuv2-67/49y2uv2-11334xzuv2-10482yzuv2-60/91z2uv2+94/65xu2v2-108/17yu2v2-69/70zu2v2-23/20u3v2+8/115x2v3+29/41xyv3+8/15y2v3-95/6xzv3-9714yzv3+2550z2v3-121/80xuv3+67/18yuv3+43/5zuv3+23/124u2v3-12509xv4-104/79yv4-73/21zv4-1238uv4+9038v5,94/107x4y+47/14x3y2-6362x2y3-20/59xy4-43/120y5-3028x4z-15141x3yz-2028x2y2z+84/115xy3z-3024y4z+2811x3z2+47/45x2yz2+121/101xy2z2-100/57y3z2+8/115x2z3+1/101xyz3-13/112y2z3+3618xz4+88/67yz4-52/63z5+102/97x4u-12/89x3yu-102x2y2u-3846xy3u-61/86y4u+85/54x3zu+78/29x2yzu-13381xy2zu-49/95y3zu-77/2x2z2u-5784xyz2u+1557y2z2u-9163xz3u-114/121yz3u-57/103z4u+36/31x3u2-9062x2yu2-23/111xy2u2+7362y3u2-7671x2zu2+14945xyzu2+7901y2zu2+51/5xz2u2-109/48yz2u2+7696z3u2+11280x2u3-44/57xyu3-13736y2u3-13458xzu3-14723yzu3-707z2u3+899xu4-10381yu4+99/25zu4-7788u5-237x4v+45/43x3yv-7666x2y2v-4/109xy3v+4303y4v-13107x3zv-108/91x2yzv-7707xy2zv-73/47y3zv+61/118x2z2v-11/65xyz2v+2970y2z2v-104/37xz3v-15408yz3v-64/55z4v+47/113x3uv+2185x2yuv+7941xy2uv-61/37y3uv+6482x2zuv-11/70xyzuv+83/110y2zuv-109/83xz2uv-86/95yz2uv-7583z3uv+83/45x2u2v+89/38xyu2v-2/11y2u2v+3577xzu2v+124/125yzu2v-1151z2u2v+109/85xu3v+70/13yu3v+37/104zu3v-210u4v+51/29x3v2-104/111x2yv2+105/58xy2v2-13459y3v2-80/79x2zv2-3006xyzv2-115/16y2zv2+8208xz2v2+35/38yz2v2+49/27z3v2-1647x2uv2+10482xyuv2-34/93y2uv2+97/18xzuv2+101/20yzuv2+1711z2uv2+91/36xu2v2-96/23yu2v2+7006zu2v2+86/31u3v2-10734x2v3-43/18xyv3-4597y2v3-11174xzv3-7334yzv3+7/96z2v3+4/97xuv3-5/82yuv3-15600zuv3-69/94u2v3-71/25xv4+21/97yv4+117/23zv4-6557uv4-67/83v5,8164x4y+19/73x3y2-1592x2y3-28/87xy4-63/103x4z+11/42x3yz-52/67x2y2z-13766xy3z+11378y4z+10/37x3z2+115/41x2yz2+11/100xy2z2-49/40y3z2+86/111x2z3+124/5xyz3-25/79y2z3-14525xz4+11380yz4-53/42z5-12169x4u-14/51x3yu+68/33x2y2u-3/62xy3u-31/22y4u-74/93x3zu+12924x2yzu-103/123xy2zu-74/97y3zu-2789x2z2u-95/32xyz2u+45/13y2z2u+40/71xz3u+49/110yz3u+34/75z4u+9829x3u2-59/92x2yu2+106/65xy2u2+123/86y3u2+7133x2zu2-73/46xyzu2-7/29y2zu2-937xz2u2-65/67yz2u2-88/111z3u2-61/119x2u3+975xyu3-54/7y2u3-37/33xzu3+61/59yzu3+51/115z2u3+117/43xu4+8506yu4+13941zu4-14945u5-115/63x4v-14237x3yv-74/87x2y2v+104/47xy3v-95/104y4v+11535x3zv-119/75x2yzv-44xy2zv+11299y3zv-21/113x2z2v-2852xyz2v+95/77y2z2v-75/19xz3v-4864yz3v-79/88z4v+139x3uv-10068x2yuv+2049xy2uv+7515y3uv+97/56x2zuv+109/113xyzuv+7778y2zuv-71/11xz2uv-80/19yz2uv+55/59z3uv-69/98x2u2v-15679xyu2v+114/11y2u2v+69/65xzu2v+879yzu2v+45/104z2u2v+47/97xu3v-1373yu3v+15885zu3v+11121u4v-5042x3v2+4/25x2yv2-8607xy2v2-25/33y3v2+93/55x2zv2+68xyzv2-4167y2zv2+14180xz2v2-115/47yz2v2-81/67z3v2-12099x2uv2+34/107xyuv2+122/59y2uv2+775xzuv2-91yzuv2-85/96z2uv2-59/95xu2v2+174yu2v2+11/16zu2v2+66/37u3v2-121/36x2v3+6070xyv3-83/52y2v3-121/59xzv3-55/12yzv3+8088z2v3-20/29xuv3+76/125yuv3-10858zuv3+1833u2v3-103/50xv4+76/93yv4-119/18zv4+37/114uv4+51/7v5,85/56x4y-7839x3y2+12/37x2y3+6558xy4-8191x4z+115/7x3yz+81/23x2y2z-4121xy3z-1131y4z-23/37x3z2-71/32x2yz2+30/97xy2z2+5070y3z2-49/123x2z3+103/88xyz3-45/19y2z3+5132xz4+7277yz4+1896z5-103/75x4u-12020x3yu+12337x2y2u+6248xy3u+14290y4u-87/44x3zu-5364x2yzu-11801xy2zu-59/37y3zu+34/109x2z2u-14482xyz2u-10338y2z2u+118/73xz3u+7/8yz3u+158z4u+10590x3u2-5182x2yu2+83/62xy2u2+11557y3u2-92/119x2zu2-37/94xyzu2+5383y2zu2-365xz2u2+7/62yz2u2-7965z3u2-10/43x2u3+119/101xyu3-113/83y2u3-121/41xzu3+61/104yzu3+37/60z2u3-74/95xu4-113/66yu4-205zu4+4787u5-94/93x4v+14871x3yv-14723x2y2v+10730xy3v+112/17y4v-35/19x3zv-3487x2yzv-65/43xy2zv-7445y3zv-79/124x2z2v+7423xyz2v+91/2y2z2v+91/34xz3v-6970yz3v-50/113z4v+75/43x3uv-127x2yuv+11978xy2uv+48/113y3uv+113/62x2zuv-8941xyzuv-101/112y2zuv-5737xz2uv-31/123yz2uv+9490z3uv+19/92x2u2v-107/73xyu2v-23/121y2u2v+38/65xzu2v-672yzu2v+13/77z2u2v+46/119xu3v-103/18yu3v+107/59zu3v-52/21u4v-94/87x3v2-74/31x2yv2-9/22xy2v2-2896y3v2+113/3x2zv2-5386xyzv2-11391y2zv2+42/97xz2v2+77/64yz2v2-1610z3v2-102/43x2uv2+124/39xyuv2+14829y2uv2+88/113xzuv2-10411yzuv2-51/43z2uv2-36/121xu2v2+9487yu2v2-5589zu2v2+4335u3v2-5/91x2v3+6084xyv3-56/39y2v3-84/101xzv3-81/85yzv3-6521z2v3-2432xuv3+14317yuv3-43/82zuv3+121/8u2v3+14783xv4-92/45yv4+112/27zv4-8410uv4+31/105v5,-6691x4y-10158x3y2-5372x2y3+4132xy4+106/9y5+15600x4z-803x3yz+43/29x2y2z+9/91xy3z-92/61y4z+4807x3z2-12562x2yz2+14234xy2z2-91/17y3z2-91/30x2z3-10615xyz3-4206y2z3-29/45xz4-11/86yz4-115/9z5+125/112x4u+52/59x3yu+92/49x2y2u+121/85xy3u-51/14y4u-73/48x3zu-1/110x2yzu+12/65xy2zu+15045y3zu+12826x2z2u-123/89xyz2u+9465y2z2u-67/31xz3u-5080yz3u-7944z4u-107/72x3u2+1473x2yu2+7965xy2u2+15753y3u2-95/98x2zu2-9827xyzu2-25/53y2zu2-83/54xz2u2-13217yz2u2-117/110z3u2+230x2u3-12120xyu3+11/36y2u3-2071xzu3+109/59yzu3+6909z2u3-15/64xu4+45/82yu4-3091zu4-15711u5+5957x4v-45/86x3yv+26/29x2y2v-40/57xy3v+25/43y4v+126/37x3zv-38/33x2yzv+65/109xy2zv-33/68y3zv-7287x2z2v-4842xyz2v+35/118y2z2v+6157xz3v-97/89yz3v-91/50z4v-70/27x3uv+32/9x2yuv+78/125xy2uv+38/7y3uv-3214x2zuv-68/101xyzuv+87/55y2zuv-69/98xz2uv+5805yz2uv+41/102z3uv-43/54x2u2v-42/73xyu2v-13/49y2u2v+11864xzu2v+121/37yzu2v-100/109z2u2v-12609xu3v-9114yu3v-8746zu3v+11659u4v+3799x3v2-9581x2yv2+60/91xy2v2+2029y3v2+12075x2zv2+210xyzv2-1/22y2zv2+17/58xz2v2+1212yz2v2+118/27z3v2-3571x2uv2-3139xyuv2-23/100y2uv2-1240xzuv2+71/49yzuv2-21/103z2uv2-110/71xu2v2-40/77yu2v2-103/29zu2v2+10737u3v2+2828x2v3+14/39xyv3+7564y2v3+113/50xzv3+38/79yzv3+59/66z2v3+2726xuv3+91/94yuv3-15730zuv3-13408u2v3-97/42xv4+54/29yv4-33/73zv4+4823uv4+57/71v5,-14556x3yz-9751x2y2z-45/28xy3z+85/23y4z+5623x3z2+5369x2yz2-19/60xy2z2-36/5y3z2-95/36x2z3+5862xyz3-5/93y2z3+2949xz4+11357yz4-5679z5-52/45x3yu+4448x2y2u-9/22xy3u+2427y4u+3296x3zu+16/39x2yzu+53/57xy2zu+15/41y3zu+9473x2z2u+37xyz2u-58/69y2z2u-23/56xz3u-13/90yz3u-54/29z4u-41/67x3u2+10258x2yu2+23/44xy2u2-12952y3u2+2124x2zu2-1677xyzu2+12911y2zu2+22/45xz2u2+17/84yz2u2+5910z3u2+4782x2u3+119/39xyu3-17/84y2u3-120/91xzu3+35/59yzu3+17/77z2u3-4467xu4-77/4yu4-26/53zu4-3580u5-11977x3yv-118/77x2y2v+6040xy3v+9724y4v-47/5x3zv+59/101x2yzv+1212xy2zv-7/121y3zv+93/53x2z2v-56/23xyz2v-4470y2z2v+110/111xz3v-41/99yz3v-81/10z4v-71/24x3uv+26/115x2yuv+59/39xy2uv-10029y3uv+11748x2zuv+5749xyzuv+6887y2zuv+38/3xz2uv-116/61yz2uv-55/118z3uv+105/22x2u2v+70/87xyu2v-28/13y2u2v-109/123xzu2v-102/47yzu2v-52/71z2u2v+101/95xu3v+51/16yu3v+15/97zu3v-78/125u4v+35/46x3v2-9526x2yv2+10781xy2v2-119/44y3v2-23/10x2zv2+59/29xyzv2-15144y2zv2+29/120xz2v2-53/126yz2v2-93/85z3v2+53/8x2uv2-487xyuv2-12143y2uv2+13825xzuv2+55/6yzuv2-4250z2uv2+4237xu2v2-109/9yu2v2+67/53zu2v2+82/33u3v2+8660x2v3+15046xyv3-79/84y2v3-10310xzv3+110yzv3-7636z2v3+57/92xuv3-22/119yuv3-95/103zuv3+5138u2v3+123/49xv4-7587yv4+30/41zv4-124/121uv4+54/71v5,-29/60x4y-108/77x3y2-109/37x2y3-3619xy4+109/6x4z-37/67x3yz+53/45x2y2z+5291xy3z-2927y4z+34/5x3z2+87/17x2yz2+100/89xy2z2-114/29y3z2-4057x2z3-1/42xyz3-14/61y2z3-398xz4-122/73yz4+66/37z5+99/37x4u-5691x3yu-8778x2y2u+17/115xy3u+51/113y4u-71/101x3zu+85/91x2yzu-92/9xy2zu-3442y3zu+109/26x2z2u+50/37xyz2u+77/94y2z2u+16/35xz3u+9985yz3u+5/102z4u-5932x3u2+89/125x2yu2-895xy2u2-12455y3u2-630x2zu2-64/47xyzu2+25/9y2zu2+7906xz2u2+6827yz2u2+9808z3u2-113/118x2u3+79/8xyu3+9484y2u3+62/39xzu3+6/85yzu3-23/49z2u3-93/115xu4-11/93yu4-15177zu4-13/2u5-7623x4v-103/73x3yv-96/115x2y2v+39/76xy3v+80/79y4v+43/68x3zv+45/97x2yzv+101/87xy2zv+4632y3zv-918x2z2v+8248xyz2v-4276y2z2v+8853xz3v-39/61yz3v-121/87z4v+9968x3uv+473x2yuv+117/56xy2uv-19/21y3uv+121/119x2zuv+3/98xyzuv-65/42y2zuv-3723xz2uv+7/34yz2uv-112/87z3uv+103x2u2v+25/41xyu2v-14459y2u2v-56/41xzu2v-59/81yzu2v-109/102z2u2v-87/16xu3v-13011yu3v+49/123zu3v+106/89u4v-61/51x3v2+14107x2yv2+8035xy2v2-8853y3v2+5723x2zv2+123/53xyzv2-9727y2zv2-102/83xz2v2+1111yz2v2-15745z3v2+83/118x2uv2-57/35xyuv2-48/73y2uv2-28/37xzuv2-27/97yzuv2-27/58z2uv2+71/93xu2v2+117/8yu2v2+12344zu2v2-2497u3v2-118/71x2v3-11/19xyv3+21/104y2v3+32/113xzv3+15544yzv3+31/18z2v3+5909xuv3-67/58yuv3+27/35zuv3+115/9u2v3+79/13xv4+6722yv4-37/114zv4-71/124uv4+4657v5,-77/61x4y-88/101x3y2+93/88x2y3-11/70xy4+9806y5+7896x4z-4699x3yz+55/122x2y2z-63/122xy3z-125/74y4z+47/45x3z2+101/17x2yz2+92/47xy2z2+69/82y3z2+12402x2z3+113/98xyz3-101/33y2z3-15376xz4+47/71yz4-73/10z5+65/74x4u-14409x3yu-14478x2y2u+13593xy3u+102/97y4u+39/62x3zu-34/125x2yzu-83/9xy2zu+45/113y3zu+14484x2z2u-15293xyz2u-26/55y2z2u-958xz3u+67/35yz3u-93/19z4u+25/16x3u2+107/52x2yu2-4599xy2u2-86/51y3u2-9885x2zu2-77/47xyzu2+33/65y2zu2+90/109xz2u2-61/26yz2u2+6198z3u2-38/37x2u3-13935xyu3-142y2u3-64/5xzu3-7228yzu3+1251z2u3+1556xu4+117/121yu4-92/35zu4+99/92u5+13493x4v+12654x3yv+32/101x2y2v-11118xy3v+43/51y4v-575x3zv+103/21x2yzv+85/24xy2zv+1788y3zv+85/3x2z2v-64/25xyz2v+57/35y2z2v+37/120xz3v-69/110yz3v+48/49z4v+55/114x3uv-6439x2yuv+31/51xy2uv-90/49y3uv-45/104x2zuv-12018xyzuv+6/119y2zuv+40/63xz2uv+20/91yz2uv+50/43z3uv+1/26x2u2v-109/47xyu2v+99/7y2u2v+72/83xzu2v+61/118yzu2v+3530z2u2v+6146xu3v+117yu3v-9921zu3v-8708u4v-10/47x3v2-15294x2yv2-7336xy2v2+1/66y3v2-3057x2zv2+74/123xyzv2+146y2zv2-103/34xz2v2-117/76yz2v2+8472z3v2-7/92x2uv2+10033xyuv2+43/53y2uv2+4694xzuv2-49/2yzuv2-71/73z2uv2-125/17xu2v2-9817yu2v2+7218zu2v2+6897u3v2-19/90x2v3+11899xyv3-11779y2v3-5456xzv3+17/42yzv3+15340z2v3+12/7xuv3+9580yuv3-502zuv3-14069u2v3-4371xv4+14452yv4-9423zv4-117/122uv4+1126v5,49/108x4-39/4x3y-67/21x2y2-8/69xy3-9779y4+57/14x3z-11145x2yz+6928xy2z-7824y3z+1/79x2z2+5173xyz2-62/15y2z2-123/112xz3+88/79yz3+1/125z4+57/23x3u-11856x2yu-7444xy2u+115/8y3u-11133x2zu+71/73xyzu-7941y2zu+69/65xz2u+22/75yz2u+65/121z3u+9471x2u2+9167xyu2+51/59y2u2+12835xzu2+15047yzu2+11102z2u2-10059xu3+19/28yu3+65/21zu3-39/28u4-3/73x3v+94/61x2yv+8778xy2v-12922y3v-8711x2zv-37/97xyzv+14270y2zv+4487xz2v-59/112yz2v-14183z3v+15553x2uv+3579xyuv+114/91y2uv-4/97xzuv+13/85yzuv-89/15z2uv+58/75xu2v-34/7yu2v-90/61zu2v+90/101u3v-14673x2v2+90/19xyv2-45/37y2v2+23/49xzv2-71/11yzv2+119/8z2v2+89/10xuv2+109/91yuv2+36/49zuv2-7/31u2v2-40/113xv3-21/121yv3+9910zv3+33/14uv3-23/79v4,93/70x4-43/125x3y+9582x2y2+7565xy3-11511y4-3/79x3z-36/107x2yz-2038xy2z+879y3z-4700x2z2+103/14xyz2+102/79y2z2-67/68xz3-44/25yz3+105/79z4-29/24x3u-74/83x2yu+67/43xy2u+49/12y3u-115/11x2zu+23/67xyzu-61/27y2zu+12257xz2u+14068yz2u+23/15z3u+607x2u2+73/8xyu2+14237y2u2-13/33xzu2+110/71yzu2+41/101z2u2+5708xu3+88/67yu3+1460zu3-2472u4-1629x3v-51/70x2yv-88/73xy2v-36/97y3v+38/11x2zv+15899xyzv+54/19y2zv+9460xz2v-5150yz2v+3462z3v+5522x2uv-19/123xyuv+14871y2uv+53/5xzuv-7535yzuv-13430z2uv+107/47xu2v-8307yu2v-55/79zu2v-11945u3v-16/83x2v2+115/48xyv2+12389y2v2+11545xzv2-25/26yzv2-3755z2v2+4724xuv2-31/21yuv2+7872zuv2+89/45u2v2+87/47xv3+7625yv3+13494zv3-15376uv3-25/126v4;

  def I = grobj( groebner(J), intvec(0) ); // ASSUME: no zero entries in J!
  ASSUME(0, grtest(I));
  "Input degrees: "; grview(I);

  def RR = grres(I, 0, 1); list L = RR;

  " = Non-minimal betti numbers: "; print(betti(L, 0), "betti");

  "Graded (original) structure of 'res(Input,0)': "; grview(L);

  "Graded transpose of the previous resolution "; list LLL = grtranspose1( L ); grview( LLL );

  "Its non-minimal betti numbers: "; print(betti(LLL, 0), "betti");

}

proc grorder(def M)
"USAGE:  grorder(M), graded object or list M
RETURN:  same as input
PURPOSE: reorder/transform graded object or chain complex M into block form
ASSUME:  M must be a graded object or a list of graded objects
EXAMPLE: example grorder; shows an example
"
{
  if( typeof(M) == "list" )
  { // TODO: extra grading argument???
    if( size(M) == 0 ) { return (); }

    int j = size(M);  int i = 1;

    while( i < j )
    {
      if( size(M[i]) == 0 ){ break; }
      ASSUME(0, typeof(grrange(M[i])) == "intvec");
      i++;
    }

    if( size(M[i]) == 0 ) { i--; }

    list L; module Z = 0; L[i] = Z; j = i;

    while( i > 0 )
    {
//      "i: ", i;      "A"; grview(M[i]);
      L[i] = grorder( grobj( M[i], grrange(M[i])) );
//      "B"; grview(L[i]);
      if( i < j )
      {
        ASSUME(2, size( module( matrix(transpose(L[i+1]))*matrix(transpose(L[i])) ) ) == 0 );
      };

      i--;
    };

    return (L); // ?
  }

  ASSUME(1, grtest(M) );

// "a";  grview(M);

  intvec d; module N;

  (N,d) = reorder(M, 1); kill M;

  module M = grobj(transpose(N), -d, -grrange(N)); kill N,d;

// "b";  grview(M);

  module N; intvec d;
  // reverse order:
  (N,d) = reorder(M, -1); kill M;

  module M = grobj(transpose(N), -d, -grrange(N));

// "c";  grview(M);

  ASSUME(1, issorted(grrange(M), 1) );
  ASSUME(1, issorted(grdeg(M), 1) );

  return (M);
}
example
{ "EXAMPLE:"; echo = 2;

  "Surface Name: 'rat.d10.g9.quart2' in P^4";
  int @p=31991; ring R = (@p),(x,y,z,u,v), dp;
  ideal J = x3yu2-48/11x2y2u2-8356xy3u2+35/121y4u2+31/66x3zu2-54/83x2yzu2-61/18xy2zu2+11526y3zu2+7372x2z2u2-91/60xyz2u2-95/97y2z2u2-45/71xz3u2+71/115yz3u2+25/54z4u2-61/102x3u3-12668x2yu3+6653xy2u3+41/54y3u3+87/50x2zu3-5004xyzu3+13924y2zu3+2310xz2u3-93/14yz2u3-2/93z3u3-97/125x2u4-58/11xyu4+46/73y2u4-4417xzu4+60/101yzu4+56/75z2u4-113/118xu5+115/4yu5-40zu5-8554u6-54/83x3yuv-9770x2y2uv-590xy3uv+15/49y4uv+94/69x3zuv+121/105x2yzuv+95/88xy2zuv+3186y3zuv+11/6x2z2uv-44/81xyz2uv+637y2z2uv+109/121xz3uv-33yz3uv-94/115z4uv-49/95x3u2v-11/109x2yu2v+45/113xy2u2v+97/84y3u2v+5257x2zu2v+99/49xyzu2v+12584y2zu2v-4294xz2u2v+1137yz2u2v-58/69z3u2v-4749x2u3v+120/97xyu3v-31/103y2u3v+62/97xzu3v-107/74yzu3v+53/59z2u3v+91/33xu4v+1291yu4v+23/34zu4v+58/77u5v+16/17x3yv2-750x2y2v2+86/89xy3v2+123/46y4v2+53/123x3zv2-61/99x2yzv2+12389xy2zv2+10419y3zv2+43/11x2z2v2-146xyz2v2-116/51y2z2v2+13/62xz3v2-5524yz3v2-111/118z4v2-56/55x3uv2-3038x2yuv2+14/27xy2uv2-43/64y3uv2+3385x2zuv2+25/11xyzuv2+92/41y2zuv2+28/113xz2uv2-2049yz2uv2+89/37z3uv2-13094x2u2v2-2774xyu2v2+15474y2u2v2-15791xzu2v2-71/116yzu2v2+77/41z2u2v2-83/68xu3v2-33/106yu3v2+71/37zu3v2-41/17u4v2+12052x3v3+1906x2yv3+13825xy2v3+80/7y3v3-125/96x2zv3-9661xyzv3+85/116y2zv3-72/91xz2v3+13/112yz2v3-126/97z3v3-1637x2uv3+34/103xyuv3+3844y2uv3+77/10xzuv3+6359yzuv3-11185z2uv3-124/121xu2v3+66/91yu2v3-14636zu2v3-1051u3v3+9/64x2v4-12924xyv4-119/41y2v4+74/23xzv4+1622yzv4+73/37z2v4-60/101xuv4+111/22yuv4-45/124zuv4+59/37u2v4-66/37xv5-71/99yv5+12409zv5-113/64uv5-5267v6,-x4y-22/79x3y2-125/42x2y3-116/7xy4+98/111y5-31/66x4z-118/75x3yz+110/93x2y2z-43/92xy3z-788y4z-7372x3z2-2701x2yz2-67/124xy2z2-117/62y3z2+45/71x2z3-8396xyz3-10343y2z3-25/54xz4+30/59yz4+61/102x4u+11736x3yu+12726x2y2u+41/118xy3u-15832y4u-87/50x3zu-130x2yzu+41/8xy2zu-10300y3zu-2310x2z2u-101/5xyz2u+6205y2z2u+2/93xz3u+8679yz3u+97/125x3u2-43/37x2yu2-39/80xy2u2+12139y3u2+4417x2zu2+4294xyzu2+11/58y2zu2-56/75xz2u2+8338yz2u2+113/118x2u3-10190xyu3-37/16y2u3+40xzu3+74/23yzu3+8554xu4+115/22yu4-39/79x4v+61/72x3yv+8048x2y2v-9201xy3v+16/121y4v+113/93x3zv+109/75x2yzv+12700xy2zv-10607y3zv+50/11x2z2v+1223xyz2v-103/79y2z2v-123/58xz3v+31/26yz3v-15/122z4v+122/25x3uv-99/17x2yuv+1723xy2uv-38/121y3uv+11016x2zuv-25/102xyzuv-14970y2zuv-61/6xz2uv-14981yz2uv+15900z3uv+3268x2u2v-75/19xyu2v-1436y2u2v-1764xzu2v-57/41yzu2v+12741z2u2v-14615xu3v+119/61yu3v-115/119zu3v+10501u4v-8502x3v2-51/76x2yv2-6281xy2v2+17/49y3v2-106/7x2zv2+63/101xyzv2-27/95y2zv2-1606xz2v2+9245yz2v2+1912z3v2+11155x2uv2+223xyuv2-13/18y2uv2+110/43xzuv2+76/81yzuv2-6291z2uv2+1400xu2v2-95/23yu2v2-9701zu2v2+106/105u3v2+72/47x2v3-13118xyv3+14409y2v3+37/86xzv3+44/69yzv3-325z2v3+113/71xuv3+16/81yuv3+6/19zuv3-119/39u2v3-89/9xv4+72/53yv4+112/55zv4-8587uv4-6604v5,-x3y2+48/11x2y3+8356xy4-35/121y5-12750x3yz+100/111x2y2z+45/74xy3z+99/74y4z-6/7x3z2-47/67x2yz2+11465xy2z2-11865y3z2+7776x2z3+124/45xyz3-98/115y2z3+117/85xz4-59/120yz4-8748z5+61/102x3yu+12668x2y2u-6653xy3u-41/54y4u+13408x3zu-2185x2yzu-1240xy2zu+1161y3zu+44/27x2z2u-11164xyz2u-13388y2z2u-107/13xz3u+90/71yz3u+4204z4u+97/125x2yu2+58/11xy2u2-46/73y3u2+55/48x2zu2+121/31xyzu2+126/61y2zu2-55/69xz2u2+5988yz2u2+3755z3u2+113/118xyu3-115/4y2u3+3390xzu3-5762yzu3+30/61z2u3+8554yu4-14317zu4+99/116x3yv-113/119x2y2v+50/23xy3v-37/79y4v-8668x3zv+14049x2yzv+111/35xy2zv+61/28y3zv-10171x2z2v+68/21xyz2v+2023y2z2v-9/109xz3v+8520yz3v-2683z4v-13547x3uv+28/65x2yuv-5988xy2uv+61/111y3uv+12314x2zuv+29/44xyzuv+6141y2zuv+11280xz2uv+79/22yz2uv-38/111z3uv+19/51x2u2v+5093xyu2v-10291y2u2v-5009xzu2v-111/49yzu2v+3813z2u2v-61/37xu3v+15914yu3v-3218zu3v-12915u4v-118/101x3v2-7/57x2yv2+13128xy2v2+11606y3v2+42/101x2zv2-54/17xyzv2-43/49y2zv2-119/110xz2v2+9742yz2v2-43/4z3v2-55/8x2uv2-29/88xyuv2+12042y2uv2+101/37xzuv2-57/62yzuv2+106/97z2uv2+38/83xu2v2+8152yu2v2-5492zu2v2-47/79u3v2+15112x2v3+69/44xyv3-6/71y2v3+113/54xzv3-13210yzv3-707z2v3-119/8xuv3+3845yuv3-19/20zuv3+4852u2v3+15761xv4-12372yv4+74/69zv4-2100uv4-12833v5,-x3yz+48/11x2y2z+8356xy3z-35/121y4z-31/66x3z2+54/83x2yz2+61/18xy2z2-11526y3z2-7372x2z3+91/60xyz3+95/97y2z3+45/71xz4-71/115yz4-25/54z5+15/52x3yu+6039x2y2u+74/99xy3u-17/40y4u+29/50x3zu-7775x2yzu+6368xy2zu+14170y3zu+52/41x2z2u+7003xyz2u-5787y2z2u-101/37xz3u-23/28yz3u-20/63z4u+41/77x3u2+8650x2yu2-15922xy2u2-16/83y3u2+7278x2zu2+31/30xyzu2-2/107y2zu2+35/122xz2u2+85/58yz2u2-757z3u2+2/101x2u3+86/17xyu3+95/59y2u3+123/22xzu3-6869yzu3-9311z2u3-105/97xu4+5699yu4+15925zu4+13528u5-154x3yv+4187x2y2v+56/107xy3v-15932y4v-5137x3zv-37/56x2yzv+9401xy2zv+92/123y3zv-79/97x2z2v+9201xyz2v+19/53y2z2v+107/20xz3v+17/77yz3v-15306z4v+3215x3uv-79/117x2yuv-9/76xy2uv-6352y3uv+93/13x2zuv-65/89xyzuv-115/4y2zuv-34/57xz2uv+39/107yz2uv+31/9z3uv+107/48x2u2v+2632xyu2v+29/96y2u2v-125/89xzu2v+29/113yzu2v+3940z2u2v-116/111xu3v+6145yu3v-105/62zu3v+101/17u4v-9281x3v2-49/107x2yv2-12154xy2v2+4/19y3v2-114/71x2zv2-15/118xyzv2+4372y2zv2+45/121xz2v2+46/111yz2v2+6614z3v2+17x2uv2+10806xyuv2-10617y2uv2-25/111xzuv2-116/27yzuv2-7/58z2uv2-686xu2v2+3/13yu2v2-17/49zu2v2-40/107u3v2+47/90x2v3-83/43xyv3-6326y2v3+49/64xzv3+113/76yzv3-122/73z2v3+10232xuv3-116/109yuv3-1990zuv3+70/51u2v3-118/19xv4-27/55yv4+21/19zv4-23/57uv4-11721v5,-3399x4y+1849x3y2-3/29x2y3+28/87xy4+10/29y5-9788x4z-49/73x3yz+13829x2y2z+118/73xy3z+13129y4z-618x3z2+92/13x2yz2+101/117xy2z2-162y3z2+24/5x2z3-29/74xyz3+2687y2z3-74/39xz4+2/57yz4+68/73x4u-13787x3yu-11659x2y2u+14729xy3u+92/53y4u+15/71x3zu-62/15x2yzu+21/85xy2zu+4938y3zu-120/37x2z2u-77/102xyz2u-4785y2z2u-83/70xz3u-12128yz3u-13592z4u-123/20x3u2+2607x2yu2+40/19xy2u2+6361y3u2-3091x2zu2+89/113xyzu2+149y2zu2-2890xz2u2-8374yz2u2+11886z3u2-49/43x2u3-9854xyu3-6943y2u3+10743xzu3-122/45yzu3-13902z2u3-103/19xu4-48/59yu4+27/86zu4+46/35u5-117/17x4v-15/7x3yv+8409x2y2v-83/28xy3v+86/35y4v+37/45x3zv+4/3x2yzv+35/38xy2zv+4015y3zv-49/111x2z2v-1260xyz2v-25/33y2z2v+116/19xz3v+93/8yz3v+5755z4v-25/89x3uv-11669x2yuv-64/107xy2uv+2993y3uv+7767x2zuv-17/95xyzuv-103/80y2zuv-14576xz2uv+80/47yz2uv+25/107z3uv+103/2x2u2v+125/117xyu2v-2/89y2u2v-5298xzu2v-50/27yzu2v-71/53z2u2v+2652xu3v+15761yu3v+2124zu3v+11/82u4v+100/63x3v2+4180x2yv2+11/39xy2v2-1221y3v2+108/125x2zv2+97/126xyzv2-7698y2zv2+13984xz2v2+1342yz2v2-84/121z3v2-26/73x2uv2-14/15xyuv2-22/37y2uv2-71/82xzuv2+12430yzuv2+103/52z2uv2-13095xu2v2+10114yu2v2-8/73zu2v2-33/97u3v2+83/105x2v3+22/45xyv3-7961y2v3-9654xzv3-54/55yzv3-3/71z2v3-10148xuv3-117/98yuv3+101/102zuv3-606u2v3+97/43xv4-68/21yv4+63/16zv4+42/17uv4+5834v5,-3399x3y2-32/113x2y3+14/99xy4+15001y5-121/115x3yz+4604x2y2z+7/2xy3z+9532y4z-3267x3z2+97/118x2yz2-14238xy2z2-80/21y3z2-12332x2z3-19/69xyz3+116/15y2z3-103/32xz4+15340yz4+10509z5+112/109x3yu-97x2y2u-40/11xy3u+90/29y4u-95/106x3zu-114/67x2yzu+113/48xy2zu+12080y3zu-44x2z2u+18/17xyz2u-4814y2z2u-103/100xz3u-96/61yz3u-205z4u-87/82x3u2-97/108x2yu2+3230xy2u2+104/83y3u2+41/86x2zu2+116/49xyzu2-59/110y2zu2+14/59xz2u2-6962yz2u2-2185z3u2+59/91x2u3+2497xyu3+3/37y2u3-13010xzu3+6/83yzu3-11448z2u3+13/72xu4-69/62yu4-2869zu4+23/73u5-20/43x3yv+5074x2y2v+28/125xy3v-2706y4v+13010x3zv-17/109x2yzv+21/4xy2zv+59/93y3zv-2406x2z2v+117/11xyz2v-14978y2z2v+70/89xz3v-33/7yz3v-13676z4v-13690x3uv+9825x2yuv-117/107xy2uv+12760y3uv-93/98x2zuv-113/64xyzuv+113/103y2zuv-9748xz2uv+11016yz2uv-10729z3uv+90/13x2u2v-13/47xyu2v-11/39y2u2v+20/69xzu2v+5531yzu2v+125/49z2u2v-11025xu3v-9621yu3v+113/109zu3v+4710u4v-107/7x3v2+110/119x2yv2-10025xy2v2-6644y3v2-5041x2zv2+5/96xyzv2+11472y2zv2-5128xz2v2+2927yz2v2+121/18z3v2-125/89x2uv2+12936xyuv2-71/47y2uv2+34/47xzuv2-75/103yzuv2-2654z2uv2-2350xu2v2-7707yu2v2+47/72zu2v2-952u3v2-21/67x2v3+58/37xyv3-8757y2v3+3615xzv3+44/123yzv3-13027z2v3-9/10xuv3+75/43yuv3+115/18zuv3+8071u2v3-26/3xv4-67/65yv4+14186zv4-41/122uv4+33/28v5,-3399x3yz-32/113x2y2z+14/99xy3z+15001y4z-9788x3z2+37/96x2yz2+7743xy2z2+31/55y3z2-618x2z3-8171xyz3+82/109y2z3+24/5xz4+88/85yz4-74/39z5-13165x3yu+3407x2y2u-12509xy3u-23/45y4u-11774x3zu-10/67x2yzu+69/79xy2zu-10/123y3zu-7636x2z2u+83/32xyz2u+51/112y2z2u+19/8xz3u+9309yz3u-44/49z4u+4089x3u2-374x2yu2-919xy2u2+98/107y3u2+2776x2zu2+85/26xyzu2+31/13y2zu2-103/82xz2u2+35/76yz2u2+59/45z3u2+2950x2u3+27/44xyu3+88/71y2u3+7/114xzu3-72/77yzu3+12917z2u3-34/67xu4-85/82yu4-55/84zu4+4690u5+11/42x3yv-19/125x2y2v-8288xy3v+9199y4v-12929x3zv+13357x2yzv-4903xy2zv-584y3zv-10/33x2z2v+59/113xyz2v+103/92y2z2v+101/69xz3v+8708yz3v-8/7z4v+13560x3uv-43/49x2yuv-121/98xy2uv+75/79y3uv-39x2zuv-88/69xyzuv-89/78y2zuv+110/67xz2uv+61/4yz2uv-98/45z3uv+82/7x2u2v-85/41xyu2v+6548y2u2v+9367xzu2v-59/81yzu2v-14408z2u2v+2363xu3v-80/11yu3v-50/17zu3v-14799u4v-53/21x3v2+9437x2yv2-117/80xy2v2+81/85y3v2-8/45x2zv2-6428xyzv2+15126y2zv2+68/89xz2v2+7/122yz2v2+9639z3v2+113/4x2uv2-8678xyuv2-104/45y2uv2-79/90xzuv2+39/101yzuv2-7234z2uv2-28/43xu2v2+1251yu2v2-97/56zu2v2+17/41u3v2+107/24x2v3+2747xyv3+9933y2v3-4199xzv3+53/83yzv3+6364z2v3-5456xuv3+618yuv3-123/55zuv3+2375u2v3+63/76xv4-115/106yv4-8811zv4-31/75uv4+10/109v5,13/89x4y+77/31x3y2+36/83x2y3-11411xy4+6936y5-12223x4z+7400x3yz+33/118x2y2z-12146xy3z+108/79y4z+82/99x3z2-9877x2yz2-79/70xy2z2-19/123y3z2-1491x2z3+7953xyz3-43/126y2z3+60/17xz4+98/57yz4-13317x4u-77/27x3yu-6811x2y2u-69/61xy3u+6144y4u+5404x3zu+121/120x2yzu-91/23xy2zu-71/106y3zu+1435x2z2u-120/13xyz2u-12019y2z2u-68/7xz3u-113/82yz3u+11526z4u-8706x3u2-89/53x2yu2-14804xy2u2+120/107y3u2+71/94x2zu2-1/70xyzu2+1532y2zu2+4470xz2u2+13/60yz2u2-115/102z3u2-82/21x2u3+27/121xyu3-4439y2u3-101/47xzu3-3186yzu3-106/101z2u3-10169xu4+19/58yu4-96/73zu4-7959u5-10526x4v-107/92x3yv+47/6x2y2v-23/43xy3v-69/62y4v+59/65x3zv-28/95x2yzv+5479xy2zv-39/77y3zv+11/69x2z2v-11713xyz2v+43/79y2z2v-15602xz3v+16/73yz3v-13952z4v+61/82x3uv-2219x2yuv-91/106xy2uv+5/37y3uv-148x2zuv+31/51xyzuv+18/101y2zuv+97/68xz2uv-73/32yz2uv+47/2z3uv+2/41x2u2v-13009xyu2v-7/60y2u2v+15779xzu2v+72/7yzu2v-11/73z2u2v-119/44xu3v-9067yu3v+3249zu3v+61/51u4v+12525x3v2-118/9x2yv2-3270xy2v2-4/25y3v2-5075x2zv2+77/40xyzv2-89/65y2zv2+17/58xz2v2-15609yz2v2+95/54z3v2-75/79x2uv2-4907xyuv2+12418y2uv2-57/17xzuv2-8746yzuv2+13/95z2uv2-124/67xu2v2+16/13yu2v2+28/23zu2v2-10847u3v2-645x2v3+106/75xyv3+6/115y2v3-8495xzv3+58/35yzv3-9398z2v3-101/72xuv3-71/20yuv3-124/65zuv3-8971u2v3+27/28xv4+12/29yv4-4276zv4+10858uv4+29/12v5,13/89x3y2+12068x2y3-15543xy4-77/79y5+6626x3yz+64/53x2y2z-6/23xy3z-47/125y4z+14403x3z2-43/78x2yz2-31/115xy2z2+94/59y3z2-118/117x2z3-11229xyz3+2268y2z3-116/85xz4+25/58yz4+3085z5+59/27x3yu+67/82x2y2u+11/6xy3u+103/47y4u-63/80x3zu-81/47x2yzu+7760xy2zu-115/56y3zu-10/17x2z2u+101/5xyz2u+15634y2z2u+1/107xz3u-9282yz3u+43/62z4u+62/55x3u2+100/113x2yu2-9205xy2u2-46/13y3u2+43/96x2zu2+10159xyzu2+692y2zu2+859xz2u2-19/74yz2u2+123/47z3u2-9/20x2u3-11391xyu3-2375y2u3+109/24xzu3-57/53yzu3-925z2u3-82/45xu4+97/34yu4+13/82zu4-108/29u5+63/10x3yv+38/17x2y2v-19/115xy3v+3150y4v+22/69x3zv+26/57x2yzv+110/27xy2zv+87/77y3zv+85/18x2z2v+39/47xyz2v-48/17y2z2v-7/27xz3v-13/100yz3v-11662z4v-17/8x3uv+37/11x2yuv+29/11xy2uv-109/88y3uv-2817x2zuv-61/44xyzuv+10/31y2zuv+10010xz2uv+51/86yz2uv-97/83z3uv-89/96x2u2v+4030xyu2v-58/77y2u2v-114/43xzu2v-37/10yzu2v-2011z2u2v+14483xu3v-109/101yu3v+121/102zu3v-79/92u4v+15113x3v2+10781x2yv2-14259xy2v2-113/48y3v2-7/94x2zv2-17/74xyzv2-5/117y2zv2-59/75xz2v2+13188yz2v2+103/43z3v2+4/125x2uv2-52/59xyuv2+85/92y2uv2-1/46xzuv2-9106yzuv2-83/11z2uv2-23/94xu2v2+6742yu2v2-35/107zu2v2-14596u3v2-117/43x2v3+1026xyv3+90/19y2v3+14671xzv3-101/100yzv3+6962z2v3+61/68xuv3+108/37yuv3-4157zuv3-3974u2v3+15677xv4+8661yv4+8459zv4-16/23uv4-37/119v5,13/89x3yz+12068x2y2z-15543xy3z-77/79y4z-12223x3z2-13941x2yz2+115/84xy2z2+13/98y3z2+82/99x2z3+7751xyz3+122/17y2z3-1491xz4+1327yz4+60/17z5+15363x3yu+9780x2y2u+19/117xy3u-1924y4u-14600x3zu+46/41x2yzu-5466xy2zu-73/12y3zu+10838x2z2u-8302xyz2u-89/113y2z2u+53/69xz3u-9224yz3u+47/33z4u-7399x3u2+89/77x2yu2+9312xy2u2-41/80y3u2-732x2zu2-6781xyzu2-8608y2zu2-9270xz2u2-117/58yz2u2-115/68z3u2-48/31x2u3-9067xyu3+97/107y2u3+73/57xzu3-2719yzu3-110/59z2u3-37/86xu4-15796yu4-61/4zu4-115/72u5+6161x3yv+4134x2y2v+677xy3v-8375y4v+1150x3zv+1551x2yzv+4157xy2zv+112/87y3zv+8171x2z2v+6040xyz2v+15651y2z2v-7/66xz3v-47/61yz3v+77/64z4v+14848x3uv+48/119x2yuv-9534xy2uv-117/95y3uv+5/4x2zuv+122xyzuv+90/31y2zuv-41/26xz2uv+31/30yz2uv-10428z3uv-9896x2u2v-71/21xyu2v-55/38y2u2v-29/22xzu2v-11092yzu2v+39/122z2u2v+93/73xu3v+22/49yu3v-21/106zu3v+56u4v+8565x3v2-1695x2yv2+2/17xy2v2+1/78y3v2-113/71x2zv2-41/100xyzv2+55/14y2zv2+15286xz2v2+17/53yz2v2+126/71z3v2-79/87x2uv2+109/97xyuv2-28/31y2uv2-6533xzuv2+22/5yzuv2-10449z2uv2+10830xu2v2-15516yu2v2+28/57zu2v2-81/22u3v2+4198x2v3+5667xyv3-7133y2v3-8408xzv3+11066yzv3-26/125z2v3-808xuv3+95/54yuv3-64/17zuv3-5267u2v3-15333xv4+42/89yv4+63/85zv4+119/113uv4-2011v5,5583x4y+1725x3y2-8652x2y3-91/25xy4-8495x4z-13731x3yz+9298x2y2z-41/111xy3z-15503y4z-13805x3z2+3962x2yz2-2/63xy2z2+3314y3z2+2522x2z3-10/87xyz3-408y2z3+7/16xz4+69/22yz4-7254z5-59/21x4u+115/7x3yu-1718x2y2u+7851xy3u+2632y4u-82/3x3zu+37/86x2yzu+101/113xy2zu+6747y3zu-109/113x2z2u+7399xyz2u+24/103y2z2u+89/9xz3u-14630yz3u+15066z4u-12561x3u2+113/115x2yu2+87/97xy2u2-126/67y3u2-48/7x2zu2+123/103xyzu2-11/107y2zu2-2747xz2u2+8158yz2u2-3/107z3u2+41/6x2u3+12767xyu3+3873y2u3+74/83xzu3-55/119yzu3-24/83z2u3+55xu4-7/95yu4+57/44zu4+2/101u5-6928x4v-121/57x3yv+111/104x2y2v+946xy3v-29y4v+3057x3zv-14/25x2yzv+43/31xy2zv-105/2y3zv+2336x2z2v+61/77xyz2v-7880y2z2v+5/58xz3v+10593yz3v+7094z4v+63/59x3uv-5/69x2yuv-11/81xy2uv-4157y3uv+73/65x2zuv-1676xyzuv-2376y2zuv-85/63xz2uv-95/2yz2uv-14903z3uv-119/110x2u2v-115/24xyu2v+125/9y2u2v+106/87xzu2v-13/12yzu2v-4/19z2u2v+7838xu3v-43/111yu3v+7/113zu3v-12500u4v+7743x3v2-2023x2yv2-85/83xy2v2+49/41y3v2+20/87x2zv2+3932xyzv2-77/6y2zv2+47/90xz2v2-15580yz2v2+39/4z3v2-61/8x2uv2+2518xyuv2+29/98y2uv2+11057xzuv2-18/107yzuv2+708z2uv2+14720xu2v2-3175yu2v2-113/59zu2v2-14735u3v2+7/69x2v3-4029xyv3+54/91y2v3+12372xzv3+67/2yzv3+8856z2v3-2178xuv3+995yuv3+64/95zuv3+4039u2v3-37/44xv4+23/17yv4-3035zv4-103/124uv4+69/64v5,-5583x3y2-1725x2y3+8652xy4+91/25y5+6201x3yz-73/49x2y2z-3844xy3z+10548y4z-11057x3z2-105/122x2yz2+31/53xy2z2+79/89y3z2-24/101x2z3+107/119xyz3-126y2z3+8164xz4+2/77yz4-51/8z5-14941x3yu-106x2y2u+8695xy3u+125/62y4u+4328x3zu+29/117x2yzu-6249xy2zu-2791y3zu+67/49x2z2u-38/29xyz2u+122/41y2z2u+10603xz3u-3029yz3u+5578z4u+14754x3u2-108/79x2yu2+4408xy2u2-12401y3u2-1426x2zu2-1741xyzu2-83/86y2zu2+79/95xz2u2+122/121yz2u2+81/2z3u2-1172x2u3-41/68xyu3-70/3y2u3+24/107xzu3+120/79yzu3+18/119z2u3-65/122xu4+1018yu4+22/107zu4+15189u5+5/8x3yv-12060x2y2v+3/62xy3v-227y4v+60/41x3zv-123/115x2yzv+110/123xy2zv+12864y3zv-86/121x2z2v-69/94xyz2v+14/79y2z2v+118/45xz3v+10842yz3v-37/58z4v+100/69x3uv-47/65x2yuv-7/67xy2uv-93/100y3uv-6262x2zuv-4/75xyzuv+2082y2zuv-9117xz2uv+12450yz2uv-84/67z3uv+123/26x2u2v-51/89xyu2v+19/74y2u2v-104/77xzu2v+318yzu2v+12402z2u2v+95/8xu3v-81/26yu3v-4486zu3v+3872u4v+72/91x3v2-83/63x2yv2+93/92xy2v2-15924y3v2-53/62x2zv2+6046xyzv2+1408y2zv2+60/107xz2v2-1150yz2v2-126/19z3v2-7429x2uv2+2554xyuv2+3602y2uv2+10738xzuv2-57/64yzuv2+86/69z2uv2+8172xu2v2+91/113yu2v2+92/65zu2v2+118/37u3v2+47/83x2v3+12750xyv3+10851y2v3+4216xzv3+6/101yzv3-108z2v3+2920xuv3-101/102yuv3-157zuv3+7742u2v3-7234xv4-2/111yv4+59/33zv4-93/91uv4+24/19v5,1592x4y+75/121x3y2+40/19x2y3-2651xy4+9934x4z+245x3yz+11665x2y2z+30/41xy3z+1823y4z+89/88x3z2-105/46x2yz2+79/58xy2z2-4191y3z2-76/61x2z3-21/32xyz3-9516y2z3-14896xz4-85/77yz4+51/109z5+61/30x4u-10/101x3yu+11796x2y2u+76/101xy3u+123/88y4u-5932x3zu-11857x2yzu+7128xy2zu-45/79y3zu+119/18x2z2u+9/74xyz2u+7042y2z2u-1114xz3u-11/82yz3u-1466z4u-6/85x3u2+27/106x2yu2+14246xy2u2-6216y3u2+47/6x2zu2-45/59xyzu2+89/41y2zu2+41/80xz2u2-7583yz2u2-75/113z3u2-14808x2u3-10873xyu3-90/67y2u3-11081xzu3-7369yzu3-7131z2u3-1402xu4-15386yu4-108/73zu4-5039u5+120/113x4v+10617x3yv-50/87x2y2v-2395xy3v-20/69y4v-8587x3zv+12960x2yzv-41/50xy2zv-13844y3zv-65/32x2z2v-77/122xyz2v-85/66y2z2v+13/100xz3v-20/51yz3v-13676z4v+76/97x3uv+1046x2yuv-8059xy2uv-117/59y3uv-29/105x2zuv+7287xyzuv-107/119y2zuv-35/118xz2uv+79/86yz2uv-2211z3uv+5448x2u2v+62/35xyu2v-2275y2u2v+29/121xzu2v-1674yzu2v-56/43z2u2v-3377xu3v-43/110yu3v+23/10zu3v-24/61u4v+121/53x3v2-4745x2yv2-57/64xy2v2+9554y3v2-12741x2zv2+10449xyzv2+37/108y2zv2+8621xz2v2-11/57yz2v2+1566z3v2+125/49x2uv2-121/118xyuv2+109/84y2uv2-335xzuv2+10167yzuv2-59/109z2uv2-103/119xu2v2+43/13yu2v2-73/87zu2v2+2037u3v2+13002x2v3+83/48xyv3-10713y2v3+1026xzv3-105/64yzv3-37/6z2v3+14779xuv3-6448yuv3+19/69zuv3-1/110u2v3+10010xv4+79/12yv4+12/19zv4-35/61uv4-11/57v5,-1592x3y2-75/121x2y3-40/19xy4+2651y5+39/121x3yz+122/77x2y2z-114/31xy3z+1544y4z+2/3x3z2-10271x2yz2-8373xy2z2+56/61y3z2+55/48x2z3-116xyz3-25/7y2z3-108/113xz4-34/53yz4+5548z5-122x3yu-9690x2y2u+43/87xy3u-5/19y4u+97/54x3zu-17/19x2yzu+4355xy2zu+12/5y3zu-1/100x2z2u+12754xyz2u+13600y2z2u+17/45xz3u-12091yz3u+5145z4u-63/64x3u2-84/31x2yu2-97/41xy2u2+7/13y3u2-79/62x2zu2-80/103xyzu2-69/14y2zu2+119/4xz2u2-35/87yz2u2-13840z3u2+14101x2u3+7952xyu3-1857y2u3-9861xzu3+3180yzu3+75/107z2u3-250xu4-15134yu4+4717zu4-2/41u5+22/27x3yv-8983x2y2v+10520xy3v-113/2y4v+10/73x3zv-1986x2yzv-110/13xy2zv+1550y3zv+32/111x2z2v-111/35xyz2v+101/98y2z2v+8045xz3v-2/89yz3v+2924z4v-79/11x3uv-15178x2yuv+10874xy2uv+54/11y3uv-8950x2zuv+70/53xyzuv-2403y2zuv-8249xz2uv+6935yz2uv+20/89z3uv+885x2u2v-76/71xyu2v-4/17y2u2v-31/52xzu2v-4/99yzu2v+10333z2u2v-93/104xu3v+82/101yu3v-71/37zu3v+9397u4v-15/112x3v2-6614x2yv2+119/2xy2v2+88/119y3v2+306x2zv2+2790xyzv2+10992y2zv2-115/74xz2v2-14711yz2v2+11612z3v2-1788x2uv2-75/97xyuv2+79/30y2uv2+99/59xzuv2-11439yzuv2-121/113z2uv2+108/37xu2v2+37/36yu2v2-3/65zu2v2-55/42u3v2+13/100x2v3-209xyv3-1272y2v3-117/68xzv3+63/94yzv3+32/59z2v3+1013xuv3-3463yuv3+6946zuv3-37/86u2v3+67/117xv4+85/28yv4-3024zv4-82/9uv4-32/65v5,-35/52x4y-12140x3y2+23/83x2y3+69/5xy4-80/79y5+120/43x4z-11865x3yz-3487x2y2z+53/59xy3z+53/102y4z-14083x3z2-14430x2yz2-2442xy2z2-33/104y3z2-91/38x2z3+4/87xyz3-26/57y2z3+4097xz4-9/122yz4+6364z5+9634x4u-97/95x3yu-46/99x2y2u+3847xy3u+121/106y4u+12765x3zu-5292x2yzu+1607xy2zu-67/121y3zu-12/35x2z2u+4/55xyz2u-17/27y2z2u+91/122xz3u-23/31yz3u+65/49z4u+73/46x3u2-124/27x2yu2-9933xy2u2+46/75y3u2+53/114x2zu2+3503xyzu2-14147y2zu2-11283xz2u2+11889yz2u2+99/104z3u2+3117x2u3+12624xyu3-10060y2u3+2193xzu3-80/47yzu3-77/13z2u3+11/31xu4-47/90yu4+49/48zu4-2/105u5-92/61x4v+7443x3yv+35/76x2y2v+114/67xy3v-73/126y4v+97/107x3zv+9464x2yzv+10869xy2zv+15718y3zv-37/33x2z2v+124/13xyz2v-11/26y2z2v-61/40xz3v+91/100yz3v-18/103z4v+60/29x3uv+21/125x2yuv-11117xy2uv+11748y3uv-16/117x2zuv+18/103xyzuv-1711y2zuv+1872xz2uv-109/123yz2uv-18/113z3uv-26/103x2u2v+14140xyu2v+11065y2u2v+8686xzu2v-5/111yzu2v+30/101z2u2v-10501xu3v-36/113yu3v-73/74zu3v+12753u4v-43/52x3v2-76/15x2yv2-5793xy2v2+18/13y3v2+1/79x2zv2+84/23xyzv2-172y2zv2+86/77xz2v2+15/37yz2v2+11835z3v2-6482x2uv2+94/113xyuv2+10727y2uv2-102/41xzuv2+15914yzuv2-12973z2uv2-9038xu2v2-13107yu2v2+1533zu2v2+12549u3v2-13528x2v3+903xyv3+23/114y2v3-123/64xzv3-81/5yzv3+111/103z2v3+4734xuv3-33/20yuv3-7954zuv3-2478u2v3+15518xv4-6723yv4-14/31zv4-3482uv4+10919v5,-3/94x4y-12936x3y2+2/11x2y3+32/23xy4-15921y5+61/93x4z+82/111x3yz-93/2x2y2z-6659xy3z-97/90y4z+402x3z2-14586x2yz2-121/39xy2z2+68/7y3z2+1212x2z3-2980xyz3+49/52y2z3-72/89xz4+92/47yz4+8478z5+2733x4u-103/89x3yu+1166x2y2u-7/53xy3u-106/23y4u+677x3zu+907x2yzu+7891xy2zu-9014y3zu+76/47x2z2u+49/116xyz2u-49/78y2z2u+12261xz3u+118/105yz3u-126/13z4u-8812x3u2-97/120x2yu2-9534xy2u2+92/5y3u2-54/71x2zu2+94/103xyzu2+2256y2zu2+4182xz2u2-5798yz2u2-31/115z3u2-73/98x2u3+15822xyu3+1004y2u3-578xzu3+9494yzu3-6779z2u3+14506xu4+10/121yu4+58/27zu4-2817u5-19/119x4v+7128x3yv+75/64x2y2v-65/109xy3v+5129y4v-53/55x3zv+54/125x2yzv-3009xy2zv+6144y3zv+15601x2z2v+123/55xyz2v-58/77y2z2v-56/61xz3v+121/10yz3v-103/86z4v-93/25x3uv+94/123x2yuv-25/107xy2uv+14807y3uv+65/7x2zuv+87/44xyzuv+6605y2zuv+23/99xz2uv-413yz2uv-17/15z3uv-79/46x2u2v+15240xyu2v-42/67y2u2v+8932xzu2v-5888yzu2v-4204z2u2v+7002xu3v-36/97yu3v-1634zu3v+61/102u4v-14/33x3v2-6520x2yv2+9004xy2v2-67/36y3v2-7/8x2zv2-24/11xyzv2-9373y2zv2+1556xz2v2-79/74yz2v2-6691z3v2+108x2uv2-76/61xyuv2+220y2uv2-1191xzuv2-4/9yzuv2+4546z2uv2+12205xu2v2+9/22yu2v2+64/93zu2v2-44/125u3v2+292x2v3+41/74xyv3+16/79y2v3-15892xzv3+5733yzv3+6796z2v3-42/55xuv3+71/79yuv3-19/104zuv3-38/15u2v3+6436xv4+28/15yv4+87/55zv4+2270uv4-30/41v5,-117/4x3y+97/122x2y2-3618xy3+6566y4+97/113x3z-12634x2yz+9865xy2z-1764y3z+114/31x2z2+5006xyz2+7/44y2z2-15040xz3+8/125yz3+11134z4-12980x3u-79/41x2yu-79/98xy2u+89/65y3u-1217x2zu+89/87xyzu+83/66y2zu+115/11xz2u+123/107yz2u+10920z3u-86/73x2u2-11/94xyu2-14054y2u2+6752xzu2-123/124yzu2+12129z2u2-13310xu3-52/63yu3+12847zu3-1545u4-11064x3v+11499x2yv-37/64xy2v+50/103y3v+123/94x2zv-126xyzv-111/44y2zv+95/14xz2v+113/83yz2v-77/103z3v+41/64x2uv+91/90xyuv-4932y2uv+103/31xzuv+62/63yzuv+1161z2uv-99/106xu2v-3181yu2v-11741zu2v-33/8u3v-3/118x2v2-9369xyv2+527y2v2-113/39xzv2-88/49yzv2-113/101z2v2+95/68xuv2-5930yuv2-20/43zuv2+7/41u2v2+109/93xv3-107/61yv3-8352zv3-5255uv3+12021v4,-2159x4-94/3x3y-4602x2y2+1609xy3+10721y4+28/9x3z-99/35x2yz+1/110xy2z+113/114y3z-118/75x2z2-103/93xyz2-68/67y2z2+13687xz3-1531yz3+61/107z4+6076x3u+9004x2yu+2211xy2u+110/53y3u+47/102x2zu+8495xyzu-9238y2zu+57/121xz2u-8543yz2u+8/19z3u-13527x2u2-13293xyu2+1138y2u2+26/115xzu2+78/53yzu2-12556z2u2+7299xu3+70/19yu3-14687zu3+13559u4+113/9x3v-85/126x2yv-83/3xy2v-3/46y3v+1814x2zv+28/79xyzv+103/51y2zv+78/31xz2v-14387yz2v+1/88z3v+116/75x2uv-101/59xyuv-70/3y2uv+109/71xzuv+13/88yzuv-147z2uv-113/76xu2v-9661yu2v+13855zu2v-6162u3v-1857x2v2-8208xyv2-4634y2v2-6178xzv2-7352yzv2-8247z2v2-113/15xuv2+99/40yuv2+21/97zuv2+11/37u2v2-6605xv3+8964yv3+35/121zv3+8543uv3-6008v4;

  def I = grobj( groebner(J), intvec(0) ); // ASSUME: no zero entries in J!
  ASSUME(0, grtest(I));

  "Input degrees: "; grview(I);

  def RR = grres(I, 0, 1);
  list L = RR;

  " = Non-minimal betti numbers: ";  print(betti(L, 0), "betti");
  "Graded reordered structure of 'res(Input,0)': ";  grview(grorder(L));
}

proc TestGRRes(Name, J)
"USAGE:  TestGRRes(name, I), string name, ideal I
RETURN:  nothing
PURPOSE: compute/test/output/order/transpose a graded resolution of I
EXAMPLE: example TestGRRes; shows an example
"
{
  "==============================================";
  "";
  "=== Example: [", Name, "]";
  " = Ring: ", string(basering);

  def I = grobj( groebner(J), intvec(0) ); // ASSUME: no zero entries in J!
  ASSUME(0, grtest(I));
//  " = Input degrees: "; grview(I);

  " ! Resolution via 'grres': ";
  def R = grres(I, 0, 1); // sres, lres: no grading! // nres, mres - graded (with attrib(, "isHomog"))

  " = Non-minimal betti numbers: ";
  print(betti(R, 0), "betti");

  list L = R ; // SRES_list(R); //  " = Degrees of maps: "; grview(L); // MUST BE GRADED!!!

  " = Degrees of (ordered) maps: ";
  def LL = grorder(L); // MUST BE GRADED

  // ordres(L, intvec(0)); // ?

  grview( LL ); " = TRANSPOSE'd complex: %%%%%%%%%%%%%%";
  list LLL = grtranspose1( LL ); //  resolution RR = LLL;
  print(betti(LLL, 0), "betti");

  grview( LLL ); ""; //  "==============================================";

  kill L, R;
}
example
{ "EXAMPLE:"; echo = 2;
//  if( defined(assumeLevel) ){ int assumeLevel0 = assumeLevel; } else { int assumeLevel; export(assumeLevel); }; assumeLevel = 5; // store the state of aL

  // note: data from random generation 2
  string Name = "castelnuovo"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = 5153xy2-98/23y3-101/51xyz+33/41y2z+99/79xz2+7136yz2-106/111z3+119/53xyu+34/57y2u-77/92xzu+84/73yzu-109/78z2u-27/56xu2+10023yu2+82/103zu2-34/25u3+3/2xyv-68/25y2v+12721xzv+4/63yzv-73/21z2v-7291xuv-91/53yuv-4/79zuv-34/91u2v-122/53xv2+123/70yv2-64/73zv2+44/65uv2+14/31v3,xy2-15202y3+10613xyz+13640y2z-107/103xz2+5292yz2+19/119z3-10042xyu+2770y2u+7957xzu+14008yzu+92/121z2u-92/51xu2+1178yu2+1/117zu2-12726u3+82/101xyv-92/17y2v-107/56xzv+14233yzv+79/28z2v+51/50xuv-31/5yuv+95/91zuv+19/108u2v+12151xv2-69/110yv2+37/89zv2-63/116uv2-88/23v3,-5153x2+37/23xy+8706y2-13160xz+68/115yz+5548z2-22/61xu-113/98yu+11818zu+2114u2-101/97xv+89/22yv-3355zv-113/5uv-5521v2;TestGRRes(Name, I); kill R, Name, @p;  "";

  string Name = "ell.d8.g7"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = x2y2-47/69xy3+6059y4+78/85x2yz+55/124xy2z+13641y3z+8/17x2z2+7817xyz2-2746y2z2+85/124xz3+87yz3+13182z4+109/93x2yu-69/17xy2u+12089y3u+8769x2zu-53/36xyzu-14834y2zu+123/23xz2u+103/77yz2u-2344z3u-43/104x2u2-6198xyu2+47/115y2u2-39/19xzu2-29/24yzu2+51/89z2u2-65/37xu3-95/94yu3+11302zu3-53/57u4-2874x2yv+4347xy2v-25/77y3v+13819x2zv+29/34xyzv+474y2zv+33/107xz2v-3517yz2v+10617z3v+1834x2uv+54/113xyuv-8751y2uv+111/70xzuv-66/61yzuv+9195z2uv-14289xu2v-13/110yu2v+103/9zu2v+5113u3v+116/89x2v2+15142xyv2+13078y2v2-38/41xzv2-13/113yzv2-12824z2v2-57/11xuv2-114/17yuv2-125/31zuv2+11939u2v2+44/13xv3+56/69yv3+12/125zv3+643uv3+3530v4,-3454x2y-1285xy2-6182y3-8/69x2z+9/19xyz+64/49y2z+98/67xz2-13809yz2+21/44z3+77/47x2u+748xyu-41/77y2u+7318xzu+4217yzu+12562z2u-98/69xu2-14/85yu2+119/46zu2-61/121u3+5582x2v+108/77xyv-93/4y2v-65/49xzv-4135yzv+2477z2v+11114xuv+85/14yuv+51/125zuv-7572u2v-115/52xv2-7647yv2+4647zv2-5684uv2-1/55v3,3454x3-6645x2y-43/34xy2+14590y3+8/11x2z-117/112xyz+109/54y2z+6566xz2+23/57yz2-13078z3+95/61x2u+67/40xyu-4544y2u-95/72xzu-8/103yzu+100/77z2u+23/63xu2+69/61yu2-94/105zu2+8619u3+68/123x2v+8/117xyv+101/77y2v+124/125xzv+17/84yzv+23/67z2v+18/59xuv+3216yuv-77/59zuv-9/50u2v+96/109xv2-2491yv2+14089zv2+14067uv2-56/113v3;TestGRRes(Name, I); kill R, Name, @p;  "";

  string Name = "ell.d7.g6"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = 4971xy3+3/101y4-12318xy2z-12835y3z+97/98xyz2+63y2z2-8056xz3+23/91yz3-9662z4-7398xy2u+69/71y3u-53/68xyzu-49/67y2zu-113/122xz2u-9/61yz2u+71/88z3u+11358xyu2-38/29y2u2-10232xzu2+14490yzu2+2274z2u2+3501xu3+10427yu3-109/38zu3-99/5u4-6605xy2v-1555y3v-648xyzv-2083y2zv-61/41xz2v+75/17yz2v-69/55z3v-6104xyuv-9582y2uv+69/2xzuv-12551yzuv+47/49z2uv-118/13xu2v+34/105yu2v+105/41zu2v+6533u3v+122/25xyv2+2/43y2v2+16/61xzv2+11524yzv2+113/99z2v2-71/26xuv2+7809yuv2-4865zuv2-2122u2v2+53/118xv3-13209yv3-11106zv3-49/79uv3+3006v4,xy3+15492y4-13742xy2z+112/117y3z+6/47xyz2+28/41y2z2+71/111xz3+49/57yz3-61/44z4-11759xy2u+4242y3u-109/18xyzu+2260y2zu-6873xz2u-41/112yz2u+12574z3u-10939xyu2+119/38y2u2-62/33xzu2-3699yzu2+2651z2u2-13194xu3-15185yu3-11/116zu3-61/83u4-10094xy2v+13/4y3v-74/73xyzv+43/20y2zv-11547xz2v+53/43yz2v-92/93z3v+32/41xyuv+118/33y2uv-121/39xzuv-15913yzuv+53/11z2uv+97/76xu2v+85/29yu2v-5183zu2v+8520u3v+121/28xyv2+64/51y2v2-15810xzv2+1/43yzv2-6160z2v2+13988xuv2+9/40yuv2+123/4zuv2+15024u2v2+73/95xv3+80/97yv3+57/25zv3-109/81uv3-121/87v4,-4971x2+14389xy+1607y2+59/119xz+12020yz+103/122z2+8894xu+7091yu+54/19zu-50/77u2+28/25xv-113/56yv+68/29zv-14620uv+79/107v2;TestGRRes(Name, I); kill R, Name, @p;  "";

  string Name = "k3.d7.g5"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = -97/108x2y-31/118xy2-73/61y3-79/14x2z-15930xyz-2324y2z+1842xz2+656yz2-8852z3-89/38x2u-102/43xyu+14719y2u+70/67xzu+7335yzu+27/56z2u-10744xu2-55/83yu2+120/73zu2+120/61u3-126/125x2v+691xyv-15385y2v+117/16xzv-17/97yzv+80/121z2v-48/119xuv+21/34yuv-103/65zuv-49/32u2v-41/42xv2+11/75yv2-502zv2-7583uv2+26/69v3,97/108x3+77/114x2y+71/21xy2+13679y3-1645x2z-1/33xyz-79/7y2z-52/53xz2+11940yz2-5800z3+109/13x2u-115/64xyu-125/56y2u-2365xzu+2103yzu+56/87z2u-84/79xu2+107/106yu2-79/70zu2-419u3+5354x2v+92/53xyv-32/19y2v+11/74xzv+4193yzv+45/79z2v-113/72xuv+17/71yuv+11164zuv-17/33u2v+103/66xv2+55/79yv2+118/15zv2-2646uv2+57/106v3,x3-61/113x2y-64/21xy2-107/8y3-13/60x2z+43/35xyz+41/114y2z-13683xz2-5829yz2+71/38z3+90/17x2u-39/29xyu+42/5y2u-61/55xzu+111/77yzu-87/100z2u+10735xu2-83/91yu2-4884zu2-7965u3-65/12x2v+109/86xyv+10606y2v-14164xzv-6678yzv+83/18z2v-93/10xuv+120/49yuv-1592zuv-8710u2v-73/57xv2+10762yv2-2956zv2-89/63uv2-12/7v3;TestGRRes(Name, I); kill R, Name, @p;  "";

  string Name = "rat.d8.g6"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = -19/125x2y2-87/119xy3-97/21y4+36/53x2yz+2069xy2z-59/50y3z-65/33x2z2-14322xyz2+79/60y2z2-9035xz3-14890yz3+87/47z4-23/48x2yu+45/44xy2u+1972y3u+79/118x2zu-5173xyzu+115/121y2zu+1239xz2u-115/17yz2u-15900z3u-78/95x2u2+67/101xyu2-12757y2u2+12752xzu2+68/21yzu2+103/90z2u2-12917xu3+97/92yu3-24/49zu3-13/79u4-51/61x2yv-3103xy2v+77/117y3v+73/115x2zv-79/33xyzv+123/110y2zv+11969xz2v-31/95yz2v-123/95z3v-105/124x2uv+12624xyuv+2/63y2uv+6579xzuv+13/62yzuv+4388z2uv-12747xu2v-26/105yu2v-78/61zu2v-125/53u3v-5/71xyv2+62/77y2v2+21/44xzv2-9806yzv2+3/91z2v2+361xuv2+568yuv2+2926zuv2+53/38u2v2-14523yv3+2082zv3+113/115uv3,108/73x2y2+4028xy3+38/43y4-1944x2yz+39/80xy2z+8/109y3z+52/27x2z2+103/45xyz2+5834y2z2+63/101xz3+107/80yz3+1178z4-1/6x2yu+78/25xy2u-21/43y3u+50/71x2zu-14693xyzu+15074y2zu+9/103xz2u-7396yz2u-14493z3u+93/25x2u2+61/4xyu2-11306y2u2-79/81xzu2+59/82yzu2-5/106z2u2+89/71xu3-34/11yu3+15/103zu3-115/52u4-54/65x2yv+67/16xy2v-7/68y3v-10/13x2zv+32/85xyzv+1/91y2zv+107/118xz2v+7594yz2v-98/103z3v+9919x2uv-965xyuv+53/34y2uv+119/11xzuv-3400yzuv-8329z2uv+75/98xu2v-24yu2v+55/87zu2v-82/71u3v-73/115x2v2+85/19xyv2-213y2v2-7704xzv2-15347yzv2+14960z2v2+15065xuv2-125/17yuv2+32/83zuv2-14/73u2v2-21/44xv3+79/2yv3-61/32zv3+46/119uv3-2082v4,9/20x2y2+113/71xy3-88/65y4+9983x2yz-6722xy2z+87/68y3z+1893x2z2+65/32xyz2+51/55y2z2-102/53xz3+58/5yz3-7187z4-96/7x2yu-14/87xy2u-3532y3u+95/54x2zu+19/65xyzu-6728y2zu+31/121xz2u+73/106yz2u-91/5z3u-12928x2u2+707xyu2-55/48y2u2-96/25xzu2+15869yzu2-20/107z2u2-10030xu3-13786yu3-122/9zu3+19/59u4-7/52x2yv+101/74xy2v+83/6y3v-91/55x2zv-5266xyzv+85/61y2zv+126/95xz2v+56/51yz2v+13073z3v-50/21x2uv-13553xyuv-116/53y2uv+68/71xzuv-111/98yzuv-11037z2uv+68/121xu2v-124/53yu2v+54/55zu2v+5862u3v+12318x2v2-119/29xyv2+101/17y2v2-51/40xzv2-82/33yzv2-30/41z2v2-29/52xuv2+7817yuv2+8121zuv2-28/99u2v2+1125xv3-73/55yv3-14141zv3+8742uv3-1203v4,x2y2+11357xy3+295y4+144x2yz-31/54xy2z+89/119y3z+1/46x2z2+29/26xyz2+1384y2z2+1461xz3+113/91yz3+9494z4-7/32x2yu+12850xy2u-3626y3u-33/106x2zu-7/60xyzu-5935y2zu-8597xz2u+5527yz2u+1708z3u+6182x2u2-15780xyu2+4669y2u2-38/69xzu2+8412yzu2+9265z2u2-5679xu3-67/18yu3-34/67zu3-7178u4+113/56x2yv-3669xy2v+17/113y3v-87/35x2zv-4871xyzv-111/11y2zv-1131xz2v-72/13yz2v+838z3v-115/4x2uv+3395xyuv-43/68y2uv-82/13xzuv+7042yzuv-88/119z2uv+100/19xu2v+24/11yu2v+89/3zu2v+7395u3v-119/109x2v2+1/104xyv2+18/25y2v2+700xzv2-59/9yzv2-92/87z2v2+2486xuv2-67/103yuv2+1469zuv2-101/91u2v2-79/33xv3+10838yv3+81/4zv3-11843uv3+7204v4,19/125x3-15698x2y-22/117xy2-95/107y3+2027x2z-7750xyz+85/104y2z-15326xz2+31/101yz2+67/81z3-7879x2u-112/115xyu+124/81y2u+99/61xzu-7458yzu+40/33z2u-1502xu2+6591yu2-7/73zu2-42/95u3+93/83x2v-15/112xyv-84/95y2v+35/36xzv+5/24yzv-12768z2v+13232xuv-76/103yuv-79/52zuv-7217u2v+75/92xv2-49/64yv2+17/14zv2-6109uv2+1695v3;TestGRRes(Name, I); kill R, Name, @p; "";

  string Name = "k3.d14.g19"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = x4y2+52/25x3y3+73/79x2y4+33/83xy5-116/65y6+23/39x4yz-45/11x3y2z-45/16x2y3z+73/8xy4z+107/70y5z+115/8x4z2-4619x3yz2+13504x2y2z2+9/118xy3z2-113/64y4z2+10731x3z3-7/13x2yz3-26/17xy2z3+3/59y3z3-4602x2z4+71/44xyz4-66/43y2z4-37/70xz5-6988yz5-123/29z6-6158x4yu+9171x3y2u+71/122x2y3u-119/73xy4u-15409y5u+85/3x4zu+104/59x3yzu-3336x2y2zu-50/107xy3zu-10232y4zu-8965x3z2u-2736x2yz2u+4/61xy2z2u+49/92y3z2u+13261x2z3u+64/31xyz3u-89/70y2z3u+11080xz4u+10139yz4u+13653z5u+34/25x4u2-5678x3yu2+43/13x2y2u2+4119xy3u2+72/109y4u2-77/64x3zu2+15044x2yzu2+97/53xy2zu2+9036y3zu2-10599x2z2u2-107/126xyz2u2+43/12y2z2u2-4690xz3u2-43/75yz3u2-15886z4u2-113/7x3u3-242x2yu3+85/19xy2u3-20/57y3u3+109/37x2zu3+6103xyzu3-51/43y2zu3-89/92xz2u3-14/87yz2u3+59/111z3u3-40/63x2u4+113/86xyu4-17/109y2u4-11039xzu4+107/31yzu4+121/47z2u4-123/5xu5+83/97yu5+110/23zu5-122/83u6-15/17x4yv+96/65x3y2v-1491x2y3v+3885xy4v+26/87y5v-51/89x4zv-123/88x3yzv-2315x2y2zv-4119xy3zv-3390y4zv-68/5x3z2v-57/67x2yz2v-116/77xy2z2v+109/54y3z2v+23/89x2z3v+19/77xyz3v+32/107y2z3v-85/121xz4v+9325yz4v+87/32z5v-65/81x4uv-39/19x3yuv+4671x2y2uv+54/77xy3uv+8/47y4uv+1194x3zuv+5/14x2yzuv+1151xy2zuv+90/103y3zuv-55/8x2z2uv-44/101xyz2uv-4713y2z2uv-1/7xz3uv+13344yz3uv-11451z4uv-101/108x3u2v+42/55x2yu2v+4810xy2u2v-3/40y3u2v+4699x2zu2v+114/53xyzu2v+49/116y2zu2v-9/74xz2u2v-84/109yz2u2v-119/97z3u2v+15282x2u3v-109/71xyu3v+2490y2u3v-119/47xzu3v+43/40yzu3v-105/86z2u3v-101/70xu4v+10041yu4v-93/53zu4v+4204u5v+83/43x4v2+15199x3yv2+26/43x2y2v2-6627xy3v2+59/113y4v2+10482x3zv2-8354x2yzv2-78/79xy2zv2+7126y3zv2+68/25x2z2v2+94/59xyz2v2+83/45y2z2v2-59/60xz3v2+15768yz3v2+15/29z4v2-43/100x3uv2-11939x2yuv2+1832xy2uv2+29/6y3uv2+115/76x2zuv2+51/106xyzuv2+7/23y2zuv2+19/107xz2uv2-13797yz2uv2+16/109z3uv2-7519x2u2v2+3472xyu2v2-28/107y2u2v2-11283xzu2v2+12707yzu2v2+54/47z2u2v2+1841xu3v2-3037yu3v2+9239zu3v2+3729u4v2+7476x3v3+59/81x2yv3-49/85xy2v3-91/60y3v3+20/77x2zv3-2761xyzv3+4245y2zv3+97/75xz2v3+42/121yz2v3+1822z3v3-97/16x2uv3-47/10xyuv3-11222y2uv3-2194xzuv3+116/21yzuv3+118/47z2uv3-89/23xu2v3+7317yu2v3-10812zu2v3+70/13u3v3-5855x2v4-9755xyv4+14875y2v4+59/117xzv4-33/109yzv4+48/59z2v4+62/57xuv4-56/73yuv4-3601zuv4+2155u2v4-77/107xv5+12478yv5+7028zv5-3652uv5+81/28v6,-50/87x4yz-2298x3y2z+9266x2y3z-55/16xy4z+31/76y5z+13/46x4z2-11/100x3yz2+90/119x2y2z2-65/54xy3z2-102/77y4z2-76/109x3z3-6558x2yz3-60/19xy2z3-17/113y3z3-74/43x2z4+8092xyz4-13313y2z4-13/107xz5-47/82yz5+5501z6+39/17x4yu-11/13x3y2u-4407x2y3u+89/117xy4u+118/101y5u-37/57x4zu+100/33x3yzu-99/46x2y2zu-2772xy3zu-75/94y4zu-6429x3z2u-7628x2yz2u+10112xy2z2u+85/32y3z2u-4068x2z3u+81/95xyz3u+97/89y2z3u-12700xz4u+19/113yz4u+14306z5u+13878x4u2-22/21x3yu2+107/41x2y2u2-16/97xy3u2-2426y4u2-12247x3zu2+71/41x2yzu2+16/69xy2zu2+37/113y3zu2-12195x2z2u2-8354xyz2u2-6177y2z2u2-10139xz3u2+9118yz3u2-113/115z4u2-8042x3u3+37/97x2yu3+7/30xy2u3+90/73y3u3-14676x2zu3+630xyzu3+7824y2zu3-5947xz2u3-12019yz2u3+99/19z3u3+17/117x2u4+1943xyu4-47/45y2u4-79/98xzu4+46/119yzu4-98/25z2u4-20/69xu5+45/28yu5-123/14zu5-20/29u6+83/41x4yv+32/19x3y2v+5/107x2y3v+9/95xy4v+35/33y5v+14385x4zv+2237x3yzv+109/11x2y2zv-6489xy3zv-96/107y4zv+1749x3z2v+23/64x2yz2v+105/17xy2z2v+11/70y3z2v-4677x2z3v-4/119xyz3v+8243y2z3v-7538xz4v-45/58yz4v+1768z5v-10804x4uv-102/89x3yuv-80/17x2y2uv-103/66xy3uv-14/55y4uv-5981x3zuv+2/35x2yzuv+24/71xy2zuv-17/62y3zuv-59/52x2z2uv+468xyz2uv+61/110y2z2uv-1265xz3uv-11317yz3uv+15610z4uv+61/116x3u2v+1972x2yu2v+26/121xy2u2v+9787y3u2v-91/62x2zu2v+101/65xyzu2v-85/111y2zu2v+99/95xz2u2v-125/51yz2u2v+10324z3u2v+95/73x2u3v-705xyu3v-6165y2u3v+2215xzu3v-109/12yzu3v+72/95z2u3v-149xu4v+14154yu4v+412zu4v+2747u5v+113/25x4v2+5988x3yv2-119/107x2y2v2-70/41xy3v2+2891y4v2+85/103x3zv2-9398x2yzv2-116/117xy2zv2-12527y3zv2-8408x2z2v2-76/47xyz2v2+13729y2z2v2-65/77xz3v2+23/94yz3v2+61/77z4v2+18/121x3uv2-8520x2yuv2+103/34xy2uv2+17/40y3uv2+23/104x2zuv2+7/29xyzuv2-5908y2zuv2-7791xz2uv2-12032yz2uv2+125/82z3uv2-89/126x2u2v2+22/75xyu2v2-118/67y2u2v2+34/29xzu2v2+30/109yzu2v2-64/37z2u2v2-113/87xu3v2+110/109yu3v2+81/23zu3v2-40/99u4v2-14204x3v3+5939x2yv3-7749xy2v3+2924y3v3-3662x2zv3-51/122xyzv3-7218y2zv3-13482xz2v3+12673yz2v3-9675z3v3+6567x2uv3-14008xyuv3+14242y2uv3-4310xzuv3+757yzuv3-9110z2uv3+27/14xu2v3-81/40yu2v3-42/29zu2v3+7287u3v3+119/94x2v4-11926xyv4-82/117y2v4+4138xzv4-67/70yzv4+79/49z2v4-113/50xuv4+102/113yuv4-4791zuv4-11/97u2v4-19/18xv5+6866yv5+63/101zv5+4646uv5-374v6,109/29x4yz+94/43x3y2z-13879x2y3z-53/73xy4z+9074y5z+846x4z2-107/44x3yz2+62/71x2y2z2-121/68xy3z2+14200y4z2-78/89x3z3+51/94x2yz3+123/5xy2z3-731y3z3-15645x2z4-91/25xyz4+39/17y2z4+10343xz5-14671yz5+101/71z6+10467x4yu-3/64x3y2u+75/31x2y3u-43/66xy4u-118/55y5u+7/25x4zu-59/95x3yzu+11830x2y2zu-76/121xy3zu+95/72y4zu-121/53x3z2u+120/7x2yz2u-7033xy2z2u+89/2y3z2u+86/47x2z3u-13/99xyz3u-1447y2z3u+6253xz4u-9082yz4u-4518z5u+31/111x4u2+68/79x3yu2-3532x2y2u2+61/94xy3u2+1210y4u2-11697x3zu2-9386x2yzu2-8263xy2zu2+11759y3zu2+113/118x2z2u2-6488xyz2u2+41/30y2z2u2-15179xz3u2-10848yz3u2-14/51z4u2-13/123x3u3-21/10x2yu3-4018xy2u3-11558y3u3-68/13x2zu3+41/119xyzu3-94/31y2zu3+97/101xz2u3+2551yz2u3+51/73z3u3-10862x2u4-44/125xyu4+113/13y2u4-5704xzu4+65/116yzu4-9578z2u4-95/58xu5+8033yu5-79/124zu5-107/76u6+7293x4yv+15260x3y2v+32/35x2y3v+8519xy4v-50/83y5v+83/40x4zv-6104x3yzv+83/121x2y2zv+230xy3zv+9/50y4zv+1507x3z2v-75/112x2yz2v-20/7xy2z2v-12689y3z2v-75/112x2z3v-8673xyz3v+79/69y2z3v-12453xz4v-4805yz4v-125/11z5v-22/97x4uv-11396x3yuv+67/88x2y2uv-75/122xy3uv-30/29y4uv-837x3zuv-71/12x2yzuv+37/77xy2zuv+78/59y3zuv-13742x2z2uv+13080xyz2uv+643y2z2uv-7517xz3uv-15577yz3uv+52/75z4uv+12922x3u2v-14629x2yu2v-10188xy2u2v-5113y3u2v+67/51x2zu2v-15273xyzu2v-13388y2zu2v+121/109xz2u2v-64/83yz2u2v+69/20z3u2v-117/44x2u3v-7091xyu3v-118/45y2u3v+73/26xzu3v-117/38yzu3v+1448z2u3v+71/19xu4v-12698yu4v+107/81zu4v+21/43u5v-94/79x4v2-1660x3yv2-15179x2y2v2-10/71xy3v2+9523y4v2+6/115x3zv2-15x2yzv2+15142xy2zv2+6157y3zv2+5/79x2z2v2+126/47xyz2v2+14/107y2z2v2+35/11xz3v2-65/51yz3v2-7246z4v2-2652x3uv2-79/69x2yuv2-21/59xy2uv2-14050y3uv2-89/81x2zuv2+91/55xyzuv2-7501y2zuv2-7688xz2uv2-73/102yz2uv2-27/13z3uv2-2186x2u2v2+120/31xyu2v2+45/43y2u2v2-101/16xzu2v2-69/83yzu2v2-12658z2u2v2-7658xu3v2-53/103yu3v2+11620zu3v2+672u4v2-10795x3v3+10972x2yv3-7178xy2v3+81/2y3v3+67/43x2zv3-113/12xyzv3-3947y2zv3-17/5xz2v3-102/49yz2v3-67/26z3v3+5/6x2uv3-95/4xyuv3+2582y2uv3+72/23xzuv3+8490yzuv3-46/111z2uv3+224xu2v3+658yu2v3-98/89zu2v3+7954u3v3+87/35x2v4+7260xyv4+91/40y2v4+11611xzv4+9076yzv4+6444z2v4-8/95xuv4-12845yuv4+86/61zuv4-59/113u2v4-115/84xv5-116/41yv5-119/62zv5+15120uv5-37/51v6,21/122x4yz-9662x3y2z-11556x2y3z+67/18xy4z-10712y5z-4891x4z2+113/118x3yz2-94/83x2y2z2+61/90xy3z2+108/101y4z2+9905x3z3+12/29x2yz3+13047xy2z3-55/46y3z3+59/88x2z4+59/78xyz4+11951y2z4-1357xz5-75/77yz5+15673z6+40/113x4yu+9/55x3y2u-62/83x2y3u+65/111xy4u+4184y5u-9578x4zu+124/17x3yzu+91/85x2y2zu-1/66xy3zu+4184y4zu+101/77x3z2u-12238x2yz2u-5394xy2z2u+82/9y3z2u-73/113x2z3u+3736xyz3u+52/81y2z3u+10426xz4u+11/120yz4u+89/123z5u-99/74x4u2-9/46x3yu2-57/29x2y2u2-24/125xy3u2+115/119y4u2-10/103x3zu2-66/17x2yzu2-662xy2zu2-31/17y3zu2-56/27x2z2u2-4728xyz2u2-86/59y2z2u2-19/34xz3u2+61/13yz3u2-14093z4u2-9068x3u3-115/94x2yu3+15912xy2u3-79/66y3u3-3631x2zu3+1074xyzu3-113/105y2zu3-89/109xz2u3-80/91yz2u3+119/12z3u3+19/87x2u4-42/25xyu4+116/55y2u4+10/77xzu4+74/79yzu4-77/81z2u4-90/121xu5-43/31yu5+107/122zu5+76/113u6+60/17x4yv-6269x3y2v-124/75x2y3v+89/48xy4v-69/2y5v+8832x4zv+13984x3yzv+35/29x2y2zv-65/88xy3zv+53/74y4zv-55/79x3z2v-104/105x2yz2v+50/29xy2z2v-118/119y3z2v-25/88x2z3v+69/82xyz3v-56/69y2z3v-10495xz4v-73/50yz4v+1872z5v-62/19x4uv+99/89x3yuv+3156x2y2uv+5804xy3uv+85/91y4uv+10928x3zuv-4/83x2yzuv+2839xy2zuv+11/38y3zuv+55/126x2z2uv+15613xyz2uv+69/28y2z2uv+75/17xz3uv+115/51yz3uv-111/68z4uv-9781x3u2v+2/105x2yu2v-29/10xy2u2v+90/53y3u2v-12840x2zu2v+85/71xyzu2v-91/80y2zu2v+15904xz2u2v-82/69yz2u2v-32/75z3u2v-91/2x2u3v-77/61xyu3v-9757y2u3v-97/52xzu3v-32/9yzu3v-7457z2u3v-113/100xu4v-13367yu4v-16zu4v+17/53u5v+90/103x4v2-9338x3yv2-42/61x2y2v2+57/124xy3v2-17/6y4v2+6201x3zv2+75/8x2yzv2+13205xy2zv2-21/23y3zv2+6724x2z2v2-1646xyz2v2-3/41y2z2v2+13206xz3v2+14595yz3v2+3100z4v2-94/107x3uv2+106/99x2yuv2+53/24xy2uv2-10113y3uv2+13103x2zuv2+121/124xyzuv2-104/103y2zuv2+59/62xz2uv2+13343yz2uv2-73/72z3uv2-35/123x2u2v2+91/33xyu2v2+75/58y2u2v2-69/73xzu2v2-15760yzu2v2+684z2u2v2-12551xu3v2-99/79yu3v2+74/87zu3v2+9255u4v2-9727x3v3+1222x2yv3+31/115xy2v3+37/50y3v3-86/125x2zv3-5/82xyzv3+7/2y2zv3+69/88xz2v3-25/119yz2v3-120/101z3v3-48/113x2uv3-25/97xyuv3-14896y2uv3+13431xzuv3+13246yzuv3+7556z2uv3-103/111xu2v3+13/108yu2v3+9471zu2v3+31/114u3v3-121/23x2v4-65/69xyv4+66/95y2v4+30/59xzv4-111/40yzv4+55/4z2v4+114/121xuv4+7610yuv4-9205zuv4+85/81u2v4-88/59xv5-4248yv5+95/91zv5+156uv5-71/90v6,7698x4y-93/32x3y2+95/37x2y3+29/104xy4+10/23y5-11774x4z+4544x3yz-9/85x2y2z-45/49xy3z+110/41y4z-44/91x3z2-6083x2yz2+116/111xy2z2+47/68y3z2-11603x2z3-4229xyz3-13462y2z3-31/19xz4+4222yz4-700z5-34/11x4u-20/17x3yu-2471x2y2u-11235xy3u+13259y4u-111x3zu-109x2yzu-89/61xy2zu-28/11y3zu+74/97x2z2u+5554xyz2u+75/47y2z2u-68/77xz3u+15754yz3u-7/51z4u-53/98x3u2+9699x2yu2-9/104xy2u2+64/87y3u2-95/4x2zu2-595xyzu2+4/19y2zu2-18/95xz2u2-13449yz2u2+2931z3u2-11155x2u3-83/29xyu3+7830y2u3+108/91xzu3+13161yzu3+37/42z2u3-16/79xu4-10604yu4-15832zu4+40/39u5-6020x4v+910x3yv+13/110x2y2v+7/86xy3v-97/101y4v-3286x3zv+80/91x2yzv+12467xy2zv+115/99y3zv+79/60x2z2v-8/19xyz2v+105/71y2z2v+60/119xz3v-71/15yz3v+15272z4v-7397x3uv+125/7x2yuv-9507xy2uv+5301y3uv-5605x2zuv-32/35xyzuv-5523y2zuv+67/88xz2uv+15144yz2uv+3/8z3uv-33/56x2u2v+37/29xyu2v+49/19y2u2v-10604xzu2v+37/44yzu2v-8754z2u2v+4184xu3v-56/89yu3v-23/32zu3v+74/101u4v-23/123x3v2-13803x2yv2+54/95xy2v2+9751y3v2+55/119x2zv2+75/32xyzv2+10091y2zv2+1108xz2v2-13283yz2v2+98/111z3v2+5/109x2uv2+28/79xyuv2-95/6y2uv2-7880xzuv2-12659yzuv2+14820z2uv2+4279xu2v2+79/51yu2v2-67/49zu2v2+11207u3v2+85/54x2v3-78/43xyv3-3/95y2v3-86/65xzv3+1/114yzv3+27/74z2v3-102/31xuv3-11/59yuv3-33/29zuv3-3/110u2v3-8455xv4+77/100yv4-6225zv4-70/9uv4-10939v5,-7698x5-16/39x4y+51/61x3y2+59/33x2y3+12841xy4-11040y5+14163x4z-79/55x3yz-83/18x2y2z+121/67xy3z+52/35y4z+26/15x3z2+12770x2yz2-67/15xy2z2-12895y3z2-11/16x2z3-82/45xyz3+2446y2z3+116/9xz4+6/61yz4+83/98z5+9973x4u+67/101x3yu+25/19x2y2u+7517xy3u-59/117y4u-1/86x3zu-10/119x2yzu+2552xy2zu-2448y3zu-112/45x2z2u+35/71xyz2u+12328y2z2u+124/65xz3u-15531yz3u-39/16z4u+4678x3u2-44/103x2yu2-9303xy2u2+59/20y3u2-45/97x2zu2+2707xyzu2+65/61y2zu2+75/68xz2u2+2853yz2u2-12748z3u2-17/18x2u3-115/121xyu3+72/71y2u3-12194xzu3-14204yzu3-63/17z2u3+5772xu4-99/16yu4-51/43zu4+49/43u5-2588x4v+89/44x3yv+32/107x2y2v-117/76xy3v-84/115y4v+113/30x3zv-13/68x2yzv+15120xy2zv-59/28y3zv+61/52x2z2v+12390xyz2v+11436y2z2v+109/40xz3v+40/61yz3v+65/31z4v+12764x3uv+15885x2yuv-11299xy2uv-113/66y3uv+2887x2zuv-918xyzuv+12579y2zuv+39/10xz2uv-119/53yz2uv-62/115z3uv-10887x2u2v+115/122xyu2v-8863y2u2v-30/79xzu2v-26/5yzu2v+15294z2u2v-15701xu3v-11/19yu3v+25/14zu3v-48/55u4v+1341x3v2-4973x2yv2+55/117xy2v2-1787y3v2-115/57x2zv2+28/29xyzv2-184y2zv2+11738xz2v2-8375yz2v2-5962z3v2+52/55x2uv2+17/48xyuv2-103/52y2uv2-53/25xzuv2-101/3yzuv2-123/35z2uv2-14815xu2v2-103/14yu2v2-68/81zu2v2-81/22u3v2-121/56x2v3-12609xyv3+5555y2v3+8/17xzv3-741yzv3-73/103z2v3-12550xuv3-17/78yuv3+7817zuv3+6534u2v3-15384xv4+1807yv4-4677zv4-101/115uv4-83/19v5,-53/83x5+107/75x4y+26/51x3y2+45/109x2y3-3009xy4-27/61y5+16/85x4z-14859x3yz-20/27x2y2z+6326xy3z-4508y4z-10006x3z2-11979x2yz2+8579xy2z2+14669y3z2+67/79x2z3-2551xyz3-61/124y2z3+83/10xz4+12698yz4+15/113z5+123/86x4u-77/6x3yu+15113x2y2u+79/117xy3u-115/88y4u+101/95x3zu+56/13x2yzu-25/62xy2zu+1955y3zu+70/33x2z2u+7470xyz2u-2148y2z2u-14263xz3u-3962yz3u+47/35z4u+441x3u2+14944x2yu2-2/77xy2u2+68/23y3u2-121/43x2zu2-14321xyzu2-35/32y2zu2+34/21xz2u2+11645yz2u2+7131z3u2-3615x2u3-2748xyu3-15200y2u3+81/101xzu3+39/64yzu3-3967z2u3-10346xu4+55/18yu4-8/9zu4+33/68u5-13957x4v+31/116x3yv+58/81x2y2v+36/71xy3v-5706y4v-95/48x3zv+3214x2yzv+14729xy2zv+71/109y3zv+15365x2z2v-5109xyz2v-20/107y2z2v-6/11xz3v+74/55yz3v-76/11z4v+41/72x3uv+7215x2yuv-18/59xy2uv+1741y3uv+7698x2zuv-7299xyzuv+12127y2zuv+7/93xz2uv+71/8yz2uv-123/73z3uv+13657x2u2v-98/13xyu2v+11818y2u2v+22/23xzu2v-3038yzu2v+68/61z2u2v-7173xu3v-7460yu3v+3540zu3v+27/20u4v-37/41x3v2+20x2yv2+107/82xy2v2-2237y3v2+9827x2zv2+124/27xyzv2-18/5y2zv2-77/24xz2v2-10231yz2v2-32/7z3v2-11980x2uv2-36/35xyuv2+8618y2uv2+3174xzuv2-123/2yzuv2-117/38z2uv2+117/115xu2v2+70/3yu2v2-3144zu2v2+815u3v2-116/85x2v3+98/41xyv3-648y2v3-38/5xzv3-9/125yzv3+8710z2v3+48/31xuv3+101/109yuv3+70/11zuv3-51/4u2v3-76/59xv4-93/52yv4+15291zv4+4/55uv4+64/59v5,568x5+4355x4y+48/5x3y2+33/7x2y3-53/111xy4+1749y5-23/4x4z-98/69x3yz-47/56x2y2z-8519xy3z-5/113y4z+11488x3z2+79/21x2yz2+11/89xy2z2-64/83y3z2-15697x2z3-67/86xyz3+11545y2z3+3336xz4-106/39yz4+15466z5+15202x4u-34/63x3yu-121/72x2y2u+1/52xy3u+10800y4u+4993x3zu-55/112x2yzu-26/51xy2zu-114/125y3zu+113/2x2z2u-87/88xyz2u-91/107y2z2u-65/6xz3u+15415yz3u+1373z4u-27/86x3u2-76/93x2yu2+9/22xy2u2+16/91y3u2+10326x2zu2-61/84xyzu2-28/99y2zu2+87/14xz2u2-88/45yz2u2+60/59z3u2-13/60x2u3-10824xyu3-121/119y2u3+14919xzu3-81/25yzu3+11233z2u3+14676xu4-8474yu4+12211zu4+32/83u5+57/52x4v+10/13x3yv-277x2y2v-6961xy3v-4594y4v-13439x3zv-1/30x2yzv-118/43xy2zv-62/15y3zv+76/15x2z2v+3805xyz2v-26/15y2z2v+3081xz3v+662yz3v+13856z4v+107/30x3uv+6063x2yuv+100/37xy2uv+110/107y3uv-10346x2zuv-67/44xyzuv-93/29y2zuv+17/89xz2uv-57/104yz2uv-68/91z3uv+3804x2u2v-75/107xyu2v-11842y2u2v-103/57xzu2v-37/18yzu2v+10795z2u2v-90/31xu3v+14200yu3v+97/124zu3v+5256u4v+52/101x3v2-94/107x2yv2-12841xy2v2+77/72y3v2+93/74x2zv2+7033xyzv2+87/76y2zv2-15415xz2v2-15164yz2v2-14749z3v2+86/53x2uv2+14707xyuv2+9443y2uv2+118/5xzuv2-81/2yzuv2+43/57z2uv2+59/83xu2v2-121/79yu2v2+4449zu2v2-50/63u3v2+79/31x2v3+95/32xyv3+125/107y2v3-9165xzv3+3151yzv3+5006z2v3+45/19xuv3-5194yuv3-82/11zuv3+121/15u2v3-10265xv4-99/118yv4-3162zv4-16/29uv4-37/4v5;TestGRRes(Name, I); kill R, Name, @p;  "";

  string Name = "k3.d11.g11.ss0"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = 38/41x4y+116/67x3y2+6547x2y3-50/71xy4+13/89y5+63/22x4z-12151x3yz-3400x2y2z-52/45xy3z+9027y4z+5420x3z2+6983x2yz2-3285xy2z2-47/2y3z2-137x2z3+40/51xyz3+111/40y2z3-97/93xz4+918yz4-7492z5-122/49x4u-123/47x3yu-95/32x2y2u-83/36xy3u-125/77y4u-9824x3zu-51/115x2yzu-83/18xy2zu-19/20y3zu-117/98x2z2u+885xyz2u-20/97y2z2u+69/55xz3u-11/82yz3u+93/47z4u-97/113x3u2-83/48x2yu2+12868xy2u2-4932y3u2-97/114x2zu2-121/116xyzu2-79/108y2zu2-27/68xz2u2+116/19yz2u2+10019z3u2-6268x2u3+5/31xyu3+13810y2u3-120/37xzu3-33/124yzu3-31/41z2u3+79/50xu4+71/59yu4+110/81zu4-27/53u5-12764x4v-7/22x3yv+15253x2y2v-67/29xy3v+15620y4v-1202x3zv+56/57x2yzv-99xy2zv-29/28y3zv-15010x2z2v-101/16xyz2v+11110y2z2v+7300xz3v+58/95yz3v+10228z4v+65/57x3uv+9/2x2yuv+116/27xy2uv+7960y3uv-11/8x2zuv+59/23xyzuv+19/26y2zuv+14327xz2uv-14671yz2uv+126/101z3uv+69/83x2u2v+14041xyu2v-73/90y2u2v+11/108xzu2v-5492yzu2v-3858z2u2v-2840xu3v+15365yu3v+28/113zu3v+149u4v-94/85x3v2-32/123x2yv2-1409xy2v2-8233y3v2+851x2zv2-7458xyzv2-10713y2zv2-18/11xz2v2-15/47yz2v2-32/97z3v2+39/68x2uv2-10832xyuv2+39/59y2uv2-12211xzuv2+66/71yzuv2+121/115z2uv2-65/101xu2v2+82/11yu2v2-78/103zu2v2-10128u3v2-100/33x2v3-29/28xyv3+61/29y2v3-5266xzv3+1953yzv3+5799z2v3+13/77xuv3-2680yuv3-57/98zuv3+56/125u2v3+121/42xv4+47/111yv4+2590zv4-60/53uv4+43/61v5,8057x5+3453x4y-71/57x3y2+14017x2y3+89/28xy4-15/44y5+10785x4z-14385x3yz-112/31x2y2z+29/42xy3z+162y4z-12837x3z2+31/33x2yz2+105/74xy2z2+97/59y3z2-23/61x2z3-246xyz3+65/93y2z3+1/54xz4+6/25yz4+96x4u-41/74x3yu+15120x2y2u-1465xy3u-47/42y4u+11/80x3zu-84/55x2yzu+12120xy2zu+84/65y3zu+496x2z2u-29/24xyz2u+3753y2z2u-2608xz3u+11/123yz3u+7955z4u-11390x3u2+37/79x2yu2+3230xy2u2-72/83y3u2-87/74x2zu2-11620xyzu2+8276y2zu2+608xz2u2-7002yz2u2-7897z3u2-65/97x2u3-37/3xyu3+7/43y2u3+37/20xzu3+97/28yzu3+98/19z2u3-47/45xu4-49/109yu4-53/89zu4-66/125u5+7516x4v-1097x3yv+15928x2y2v-12128xy3v-12988y4v-23/7x3zv+5146x2yzv+9/28xy2zv-1816y3zv+115/42x2z2v+11840xyz2v+40/119y2z2v-66/85xz3v-8269yz3v-59/45z4v-114/37x3uv-126/55x2yuv-31/24xy2uv-19/9y3uv+77/3x2zuv+14268xyzuv-4133y2zuv-11603xz2uv-55/83yz2uv-5/61z3uv-13069x2u2v+4387xyu2v+94/77y2u2v-111/79xzu2v-31/61yzu2v-26/53z2u2v-13/103xu3v-27/91yu3v-100/57zu3v-104/111u4v+77/15x3v2+100/69x2yv2-1664xy2v2+14971y3v2-67/45x2zv2-55/27xyzv2+13/98y2zv2-958xz2v2+3/68yz2v2+34/65z3v2+10771x2uv2+19/106xyuv2-84/125y2uv2+4723xzuv2-10707yzuv2+50/103z2uv2+1766xu2v2+110/3yu2v2-58/51zu2v2-16/105u3v2-70/111x2v3+83/103xyv3-104/83y2v3-2394xzv3+91/109yzv3-11779z2v3+111/80xuv3+41/109yuv3+71/77zuv3+110/31u2v3+8933xv4-109/113yv4-56/87zv4-120/7uv4-107/57v5,-38/41x5-116/67x4y-6547x3y2+50/71x2y3-13/89xy4-43/79x4z+1342x3yz+14316x2y2z+737xy3z+15/44y4z+124/79x3z2-67/13x2yz2+79/104xy2z2-162y3z2-109/120x2z3+4540xyz3-97/59y2z3+3772xz4-65/93yz4-6/25z5-13041x4u-90/89x3yu+107/36x2y2u+43/46xy3u-11755y4u+12017x3zu-97/58x2yzu+5592xy2zu-11967y3zu+24/79x2z2u-63/83xyz2u-7367y2z2u-62/79xz3u+55/64yz3u-67/18z4u-672x3u2+19/77x2yu2-100/63xy2u2-23/56y3u2+61/78x2zu2+120/67xyzu2+48/107y2zu2+5855xz2u2+9877yz2u2+6940z3u2+12754x2u3+12989xyu3-123/106y2u3+59/88xzu3-3400yzu3-8976z2u3+43/21xu4-86/111yu4+2/29zu4+57/31u5+79/48x4v+95/56x3yv+3056x2y2v-13681xy3v+13735y4v-122/91x3zv+79/74x2yzv+21/47xy2zv+12060y3zv-12314x2z2v+64/17xyz2v-57/52y2z2v-57/86xz3v+15436yz3v+9387z4v+3345x3uv+2/109x2yuv-13978xy2uv+5604y3uv+11645x2zuv+2633xyzuv+15505y2zuv+10/99xz2uv+14409yz2uv+8127z3uv+99/104x2u2v+14440xyu2v+37/43y2u2v-9707xzu2v+9171yzu2v-656z2u2v+3723xu3v+4/19yu3v+109/76zu3v-8740u4v+2121x3v2+34/11x2yv2-89/61xy2v2-26/21y3v2+111/22x2zv2+88/41xyzv2+119/99y2zv2+108/77xz2v2+9279yz2v2-45/116z3v2+71/107x2uv2+25/76xyuv2-112/121y2uv2-18/71xzuv2-84/125yzuv2+496z2uv2+96/113xu2v2-964yu2v2-73/4zu2v2+103/95u3v2+9962x2v3+38/39xyv3-15120y2v3+11747xzv3+2/123yzv3+14829z2v3-6538xuv3-52/63yuv3-83/107zuv3+73/37u2v3-4183xv4+11/103yv4+83/119zv4+94/31uv4-19/98v5,-12092x5-2411x4y+3922x3y2+117/41x2y3+95/22xy4+45/19x4z-5881x3yz+97/80x2y2z-4981xy3z-21/67y4z+9068x3z2+1/11x2yz2-109/65xy2z2+22/117y3z2-7823x2z3-76/75xyz3-34/25y2z3-79/5xz4-60/37yz4-87/100z5+58/83x4u-36/61x3yu+79/76x2y2u+502xy3u+4988y4u+43/38x3zu-4/107x2yzu-48/11xy2zu+11685y3zu-15002x2z2u-97/17xyz2u+93/2y2z2u-35/71xz3u+43/83yz3u-69/26z4u+119/6x3u2-87/14x2yu2-29/109xy2u2-36/97y3u2-116/119x2zu2+4610xyzu2-33/58y2zu2+121/25xz2u2-125/121yz2u2-35/121z3u2-8975x2u3+9014xyu3+14845y2u3-10277xzu3+75/124yzu3-10/83z2u3-73/69xu4+46/85yu4-4971zu4-113/4u5+9321x4v+109/19x3yv+11/17x2y2v+6672xy3v+16/99y4v+8092x3zv+1725x2yzv+80/41xy2zv+2445y3zv+4/99x2z2v+69/101xyz2v+13182y2z2v-10090xz3v+3817yz3v+106/79z4v-71/89x3uv+110/107x2yuv-56/19xy2uv-708y3uv-108/97x2zuv-11889xyzuv+9744y2zuv-24/121xz2uv-10711yz2uv+3182z3uv-22/35x2u2v+81/44xyu2v-40/31y2u2v-13494xzu2v+47/80yzu2v+71/52z2u2v-6214xu3v-5144yu3v-115/49zu3v-109/19u4v+8621x3v2-62/79x2yv2-102/103xy2v2-8174y3v2+13689x2zv2+15544xyzv2-107/73y2zv2+120/73xz2v2+19/56yz2v2-4544z3v2-824x2uv2-2/17xyuv2+67/78y2uv2-54/85xzuv2+31/51yzuv2-59/19z2uv2+50/7xu2v2+5762yu2v2+79/64zu2v2-3729u3v2+12212x2v3+1833xyv3+12543y2v3+11974xzv3-11/17yzv3-75/74z2v3+26/3xuv3-37/36yuv3-7683zuv3+14069u2v3+12261xv4+12489yv4+1657zv4+10781uv4-46/3v5,12092x4z+2411x3yz-3922x2y2z-117/41xy3z-95/22y4z+11164x3z2+6625x2yz2+112/75xy2z2+1533y3z2+60/101x2z3-173xyz3+15913y2z3+14954xz4-5022yz4+12391z5-38/41x4u-116/67x3yu-6547x2y2u+50/71xy3u-13/89y4u-12/55x3zu-10086x2yzu+6782xy2zu-111/89y3zu-52/85x2z2u+9744xyz2u+9553y2z2u-15590xz3u+76/13yz3u+5938z4u+42/11x3u2-25/116x2yu2+2554xy2u2-12842y3u2-3/88x2zu2+102/113xyzu2-10298y2zu2-32/69xz2u2+9709yz2u2+8775z3u2-9937x2u3+5128xyu3-56/75y2u3+12493xzu3-7/39yzu3-41/24z2u3-125/49xu4-15745yu4-1005zu4+16/55u5-7566x3zv+14010x2yzv+51/23xy2zv+37/113y3zv+9/14x2z2v+2251xyz2v+10076y2z2v-106/69xz3v-4060yz3v+3379z4v-11120x3uv-9744x2yuv+50/17xy2uv+7065y3uv-70/37x2zuv+10016xyzuv+47/86y2zuv+6928xz2uv-11190yz2uv-11611z3uv+15042x2u2v-52/105xyu2v+2185y2u2v-76/67xzu2v-57/104yzu2v-7610z2u2v-3912xu3v+1/48yu3v-24/109zu3v+3287u4v+17/96x2zv2+29/76xyzv2+15768y2zv2+8410xz2v2-116/41yz2v2+89/48z3v2+15119x2uv2-11840xyuv2-89/43y2uv2+10115xzuv2+93/101yzuv2+33/62z2uv2+11864xu2v2-14582yu2v2+95/53zu2v2-8816u3v2+35/43xzv3+75/107yzv3+13515z2v3-38/67xuv3+83/71yuv3+113/51zuv3-80/111u2v3+49/5zv4+13850uv4,14959x5-3/13x4y+97/37x3y2+14586x2y3-71/120xy4-10158x4z+59/50x3yz-101/96x2y2z+118/47xy3z-65/83y4z+49/66x3z2-107/18x2yz2-2/47xy2z2+104/63y3z2-121/43x2z3+9552xyz3-113/36y2z3+4699xz4+55/53yz4+16/109z5-3576x4u-103/52x3yu-8299x2y2u+1585xy3u+3377y4u+15336x3zu-119/24x2yzu-19/68xy2zu-65/11y3zu-17/117x2z2u+788xyz2u+73/115y2z2u-46/93xz3u-108/7yz3u+3774z4u-14034x3u2-15420x2yu2-5128xy2u2+83/55y3u2+17/5x2zu2+13098xyzu2+96/29y2zu2-54/115xz2u2+4/5yz2u2+2747z3u2+56/83x2u3-1545xyu3+14384y2u3+7787xzu3-69/64yzu3-27/20z2u3-17/15xu4+46/13yu4-44/41zu4-14876u5+10090x4v+184x3yv+125/44x2y2v-13987xy3v+104/123y4v+24/35x3zv+77/95x2yzv+162xy2zv+31/113y3zv-94/51x2z2v-14750xyz2v-110/101y2z2v+3224xz3v-12389yz3v-77/57z4v-7340x3uv+48/79x2yuv-55/71xy2uv-65/57y3uv+13981x2zuv+76/73xyzuv-41/22y2zuv-10847xz2uv+3230yz2uv+37/14z3uv+64/47x2u2v-89/97xyu2v-608y2u2v-93/112xzu2v-22yzu2v+7158z2u2v-120/31xu3v-13481yu3v-97/37zu3v-113/87u4v-35/19x3v2+79/53x2yv2-1037xy2v2-29/63y3v2+5990x2zv2-3380xyzv2-17/126y2zv2-40/121xz2v2-15041yz2v2+3779z3v2+13583x2uv2+11/73xyuv2+2762y2uv2-16/49xzuv2-40/93yzuv2-37/75z2uv2+13312xu2v2+4407yu2v2+5449zu2v2+3013u3v2+86/73x2v3-37/66xyv3-73/15y2v3+75/107xzv3-63/31yzv3-97/99z2v3+11234xuv3+37/92yuv3+47/27zuv3+121/26u2v3-15690xv4+73/40yv4-12281zv4+6014uv4-92/83v5,-12092x4y-2411x3y2+3922x2y3+117/41xy4+95/22y5+14327x4z+3699x3yz+18/85x2y2z-56/53xy3z-31/16y4z+5371x3z2+73/69x2yz2+65/34xy2z2-59/49y3z2+23/37x2z3-9067xyz3+79/37y2z3-17/50xz4+8412yz4+110/39z5-36/125x4u-20/51x3yu-28/123x2y2u-4482xy3u+4217y4u+8/19x3zu+9/77x2yzu-10526xy2zu+76/79y3zu-12494x2z2u-50/13xyz2u-98/123y2z2u-23/19xz3u+1491yz3u-50/109z4u-67/62x3u2+68/47x2yu2-38/99xy2u2-4891y3u2+68/113x2zu2-73/35xyzu2-2384y2zu2+71/109xz2u2-68/39yz2u2-94/125z3u2+120/121x2u3-20/39xyu3+435y2u3-23/14xzu3-39/97yzu3+75/23z2u3+71/30xu4-8426yu4+125/7zu4+11/46u5-2334x4v+9113x3yv-1060x2y2v+12839xy3v+9876y4v-8395x3zv-79/82x2yzv+89/79xy2zv+805y3zv-7473x2z2v+80/89xyz2v+105/52y2z2v-54/103xz3v-2102yz3v+19/117z4v-1326x3uv-8963x2yuv-12/13xy2uv+11798y3uv-80/7x2zuv+519xyzuv-58/67y2zuv+14572xz2uv+8426yz2uv-66/47z3uv-574x2u2v+12480xyu2v-41/89y2u2v-111/83xzu2v-58/37yzu2v-15255z2u2v+31/97xu3v-89/113yu3v+15475zu3v-3982u4v+51/8x3v2+9547x2yv2-8060xy2v2-195y3v2-5/21x2zv2-2411xyzv2+65/12y2zv2-5410xz2v2+3844yz2v2+3/61z3v2-62/101x2uv2+53/19xyuv2-6567y2uv2+11302xzuv2+123/37yzuv2-107/118z2uv2-29/79xu2v2-91/40yu2v2+40/99zu2v2-12274u3v2-47/124x2v3+12752xyv3+11039y2v3-115/43xzv3+44/79yzv3-37/28z2v3+5364xuv3+14510yuv3+3024zuv3-40/3u2v3+71/122xv4+12024yv4+10/93zv4-4183uv4+11229v5,-51/74x4y-99/61x3y2-10442x2y3+6943xy4-15040y5+126/97x4z+101/41x3yz+4018x2y2z+98/61xy3z+87/34y4z+75/52x3z2-109/70x2yz2-81/71xy2z2+8231y3z2+78/49x2z3+53/69xyz3+70/71y2z3+48/23xz4-6678yz4+14913z5-32/97x4u+78/55x3yu+11669x2y2u-58/75xy3u-61/64y4u+118/35x3zu-125/28x2yzu-125/79xy2zu-49/23y3zu-14966x2z2u-34/19xyz2u-53/126y2z2u+13854xz3u-2177yz3u+9962z4u+15886x3u2+47/38x2yu2+10992xy2u2-111/31y3u2-79/21x2zu2-14524xyzu2-3442y2zu2-45/86xz2u2+53/3yz2u2+8738z3u2+9062x2u3+3872xyu3+56/61y2u3-6255xzu3-104/107yzu3+9858z2u3+7891xu4-11114yu4+67/37zu4-15307u5-108/7x4v+11586x3yv+19/4x2y2v+14404xy3v-99/116y4v+124/33x3zv-73/17x2yzv+77/115xy2zv-4537y3zv+9949x2z2v+101/111xyz2v+6634y2z2v-11818xz3v+23/52yz3v-63z4v+7/6x3uv-13686x2yuv+15879xy2uv+4731y3uv+107/82x2zuv+104/119xyzuv-56/67y2zuv-21/5xz2uv-24/41yz2uv-125/108z3uv+58/77x2u2v+79/49xyu2v+82/19y2u2v-82/117xzu2v-8/61yzu2v+210z2u2v+27/25xu3v+71/111yu3v-14500zu3v-15/2u4v-113/108x3v2+40/31x2yv2+89/69xy2v2-8271y3v2+111/20x2zv2+1/31xyzv2-51/101y2zv2+3967xz2v2+79/32yz2v2-6893z3v2-1060x2uv2+38/5xyuv2+21/20y2uv2-79/34xzuv2+15/118yzuv2+25/106z2uv2+97/20xu2v2+6/67yu2v2+113/120zu2v2+13/3u3v2+1800x2v3-97/15xyv3-12712y2v3+49/118xzv3+5/63yzv3+234z2v3-97/123xuv3+13/88yuv3+8/103zuv3-38/97u2v3-15634xv4+18/25yv4-7517zv4+115/103uv4-56/23v5,-123/61x5+4/87x4y-15558x3y2+78/5x2y3-31/83xy4+9742x4z+23/125x3yz+1865x2y2z+56/125xy3z-4/33y4z-54/71x3z2-113/84x2yz2+37/75xy2z2+6/23y3z2-28/123x2z3+31/112xyz3-15736y2z3-106/111xz4+46/109yz4-29/10z5-28/117x4u+15892x3yu+8096x2y2u-91/29xy3u+57/92y4u+96/31x3zu+166x2yzu+2654xy2zu-11662y3zu+1565x2z2u+9017xyz2u+121/4y2z2u-29/115xz3u+9828yz3u-15873z4u-5354x3u2+118/19x2yu2+88/95xy2u2+68/19y3u2-7/110x2zu2-109/37xyzu2-45/74y2zu2+12579xz2u2-6659yz2u2+10257z3u2+7229x2u3+39/67xyu3-108/19y2u3-58/9xzu3-29/81yzu3-1461z2u3+23/43xu4-8/19yu4-44zu4+100/109u5+121/51x4v-20/39x3yv-85/121x2y2v+73/61xy3v+103/50y4v+7334x3zv+52/125x2yzv-14/55xy2zv+106/103y3zv-4079x2z2v+109/57xyz2v+123/28y2z2v-21/83xz3v+3/31yz3v-9826z4v+89/77x3uv-79/35x2yuv+8767xy2uv+83/11y3uv+113/36x2zuv-57/68xyzuv+1675y2zuv+10873xz2uv+84/11yz2uv+89/110z3uv-5834x2u2v-121/97xyu2v+49/66y2u2v-103/95xzu2v+14863yzu2v+119/94z2u2v+44/35xu3v-15429yu3v-9302zu3v-73/12u4v-77/86x3v2-121/46x2yv2+48/13xy2v2+68/115y3v2+58/63x2zv2+58/117xyzv2-16/7y2zv2-76/39xz2v2+41/103yz2v2-8042z3v2-59/5x2uv2+3277xyuv2-120/107y2uv2-5/84xzuv2-30/103yzuv2+31/71z2uv2-1593xu2v2-4668yu2v2+5749zu2v2+38/43u3v2+26/17x2v3+1894xyv3+62/17y2v3-4851xzv3-10816yzv3+62/55z2v3+1366xuv3-70/11yuv3+90/43zuv3-115/57u2v3-10886xv4+1987yv4-78/25zv4+110/29uv4+4694v5,47/12x5+64/29x4y-113/70x3y2+15185x2y3-52/81xy4+67/28x4z-4220x3yz-9239x2y2z+10/117xy3z-5609y4z-4439x3z2-61/91x2yz2+15282xy2z2+8165y3z2-19/109x2z3+123/94xyz3+62/49y2z3+77/2xz4-1/37yz4-1202z5-14940x4u+13396x3yu-6/5x2y2u-91/50xy3u+115/118y4u-455x3zu-2755x2yzu+14353xy2zu+11/53y3zu+115/57x2z2u+86/49xyz2u+43y2z2u+5247xz3u+4438yz3u+109/16z4u-3113x3u2-15629x2yu2-15664xy2u2-115/57y3u2+3/103x2zu2-3723xyzu2+89/17y2zu2-59/56xz2u2+19/123yz2u2+43/14z3u2+103/14x2u3+106/31xyu3-13591y2u3-71/43xzu3+74/119yzu3-36/113z2u3-73/96xu4-31/120yu4-105/76zu4-37/34u5-58/23x4v-11111x3yv+5888x2y2v+14867xy3v+8608y4v-2829x3zv-31/120x2yzv+6306xy2zv+5913y3zv+35/6x2z2v+75/104xyz2v+33/41y2z2v-15317xz3v-31/49yz3v-7300z4v+2214x3uv-91/46x2yuv+10949xy2uv-3/82y3uv-16/27x2zuv-14175xyzuv-13/19y2zuv-21/65xz2uv+148yz2uv+14615z3uv-43/6x2u2v-4133xyu2v+33/49y2u2v-1299xzu2v+96/53yzu2v-12667z2u2v-86/113xu3v+10437yu3v-53/13zu3v-15678u4v-53/121x3v2-20/49x2yv2+3813xy2v2+10006y3v2+15644x2zv2-99/7xyzv2-42/13y2zv2-124/57xz2v2+73/70yz2v2+110/107z3v2-97/22x2uv2-125/116xyuv2+92/93y2uv2-12120xzuv2+143yzuv2-15344z2uv2+13225xu2v2+17/104yu2v2+1212zu2v2-7685u3v2-81/4x2v3+10328xyv3-21/19y2v3+13407xzv3-1/118yzv3+59/88z2v3+965xuv3-93/43yuv3-76/85zuv3-81/86u2v3-6949xv4+9205yv4-7777zv4+15020uv4+8845v5,3079x5-28/11x4y+117/88x3y2-89/115x2y3+40/13xy4+13407y5+3942x4z+30/121x3yz-2922x2y2z-71/74xy3z-103/114y4z-89/59x3z2+12255x2yz2+44/109xy2z2+13778y3z2+103/110x2z3-73/95xyz3+8049y2z3+10042xz4-101/35yz4-1636z5-53/27x4u+130x3yu-5989x2y2u+67/109xy3u+4601y4u-12943x3zu-86/75x2yzu+5837xy2zu+107/104y3zu+2396x2z2u-25/58xyz2u+29/110y2z2u+10526xz3u-7/45yz3u-9105z4u-64/35x3u2+64/105x2yu2+113/24xy2u2-5955y3u2+20/91x2zu2+119/78xyzu2+83/8y2zu2+125/103xz2u2+83/101yz2u2+14895z3u2-118/93x2u3-19/23xyu3+100/53y2u3-92/59xzu3+34/89yzu3+9417z2u3-6626xu4-36/65yu4+119/82zu4+8761u5-15340x4v-89/115x3yv+89/85x2y2v+33/74xy3v-8088y4v+29/16x3zv-6581x2yzv-88/85xy2zv-12/11y3zv-58/19x2z2v+12219xyz2v-100/119y2z2v+116/53xz3v-67/94yz3v+13/5z4v+236x3uv+107/96x2yuv+115/113xy2uv-7860y3uv+15064x2zuv+29/59xyzuv-7/103y2zuv-71/66xz2uv-103/79yz2uv-83/4z3uv-77/23x2u2v+7/37xyu2v+106/103y2u2v+3/50xzu2v+125/17yzu2v-15620z2u2v+6424xu3v-12832yu3v+58/53zu3v-3893u4v+25/124x3v2-99/61x2yv2-61/10xy2v2-103/39y3v2-9764x2zv2+123/23xyzv2-83/126y2zv2+13541xz2v2+73/106yz2v2+1172z3v2-14333x2uv2+7/72xyuv2-41/25y2uv2-42/31xzuv2+7/12yzuv2-9744z2uv2-15518xu2v2-121/5yu2v2-7/115zu2v2+75/14u3v2-9/67x2v3+10248xyv3+5738y2v3+71/13xzv3-43/24yzv3+9/94z2v3-113/16xuv3-27/25yuv3-50/11zuv3+41/49u2v3+10896xv4-46/43yv4-58/15zv4-5671uv4-61/9v5,6254x5-95/34x4y-7133x3y2+111/38x2y3-43/19xy4-104/111y5+92/51x4z+11826x3yz+3453x2y2z+5703xy3z+13099y4z-73/79x3z2-69/11x2yz2-15727xy2z2+98/115y3z2-10548x2z3-14452xyz3-5138y2z3-138xz4+46/109yz4-5419z5+73/6x4u-63/5x3yu+31/60x2y2u-11963xy3u+6161y4u-2311x3zu+104/105x2yzu+10873xy2zu+8165y3zu-17/83x2z2u-18/91xyz2u+13544y2z2u+36/121xz3u-8704yz3u+46/7z4u+11392x3u2+133x2yu2+7460xy2u2+8831y3u2+144x2zu2-79/47xyzu2-70/113y2zu2+7369xz2u2-11234yz2u2-19/52z3u2+9830x2u3+13/41xyu3+1985y2u3-22/15xzu3-5449yzu3+5967z2u3+9321xu4+13078yu4-97/3zu4+4079u5-5700x4v+5013x3yv-10774x2y2v-13183xy3v-20/109y4v-106/65x3zv+49/117x2yzv-67/17xy2zv-13917y3zv+9457x2z2v+95/67xyz2v-108/65y2z2v+65/77xz3v-11235yz3v+125/104z4v+17/117x3uv+6355x2yuv+5/36xy2uv-117/31y3uv-1225x2zuv+117/53xyzuv-7/26y2zuv+87/46xz2uv+33/76yz2uv-82/73z3uv-34/39x2u2v+9/22xyu2v+83/11y2u2v+13740xzu2v-108/11yzu2v-9627z2u2v-32/95xu3v-7966yu3v-12400zu3v-111/91u4v+47/11x3v2-10/27x2yv2-5257xy2v2-85/19y3v2-3/62x2zv2+12660xyzv2-37/110y2zv2+10980xz2v2+73/29yz2v2+87/92z3v2-73/90x2uv2-77/25xyuv2+66/31y2uv2-23/96xzuv2-3169yzuv2+125/71z2uv2+9/11xu2v2+6550yu2v2-15163zu2v2+10810u3v2+96/79x2v3+196xyv3-95/94y2v3+15146xzv3+14695yzv3+97/80z2v3+13047xuv3-44/79yuv3-43/41zuv3+40/57u2v3-8369xv4+12/5yv4+77/100zv4-53/79uv4-53/86v5,-122/49x5-3959x4y-7277x3y2+41/93x2y3+39/59xy4-91/68x4z+37/11x3yz+11561x2y2z-5297xy3z+53/14y4z-17/122x3z2+5470x2yz2+14889xy2z2-123/49y3z2+131x2z3+13/43xyz3-82/37y2z3-106/91xz4+11066yz4-72/13z5+15904x4u+44/47x3yu+10450x2y2u+86/41xy3u-40/41y4u+17/92x3zu-81/29x2yzu-40/101xy2zu+103/59y3zu-29/72x2z2u+17/123xyz2u+38/3y2z2u+3358xz3u-69/97yz3u+7627z4u+15451x3u2+5371x2yu2-9009xy2u2-62/35y3u2-44/75x2zu2+13188xyzu2+50/51y2zu2+53/93xz2u2-6796yz2u2-13/6z3u2+39/62x2u3-22/71xyu3-32/97y2u3+43/14xzu3-9/37yzu3-48/125z2u3+100/103xu4+13286yu4+6246zu4-26/107u5-15634x4v+112/9x3yv+54/109x2y2v+23/93xy3v+101/13y4v+79/84x3zv+5290x2yzv-52/29xy2zv-109/111y3zv+107/88x2z2v+10186xyz2v+122/97y2z2v-8370xz3v-108/47yz3v+6311z4v-1126x3uv+51/10x2yuv+9201xy2uv-111/119y3uv+105/58x2zuv-74/23xyzuv-130y2zuv-99/28xz2uv+24/65yz2uv-111/49z3uv-4961x2u2v-23/42xyu2v-32/101y2u2v+48/83xzu2v-13001yzu2v-31/86z2u2v+85/91xu3v+4019yu3v-10/43zu3v+11/105u4v+9790x3v2+73/78x2yv2+63/50xy2v2+35/2y3v2-52/119x2zv2+13680xyzv2-46/55y2zv2+89/12xz2v2-23/82yz2v2-107/85z3v2-20/79x2uv2-85/111xyuv2+31/95y2uv2-13xzuv2+5661yzuv2+9399z2uv2+73/75xu2v2+4782yu2v2-5440zu2v2+45/64u3v2-1484x2v3+1/54xyv3+43/115y2v3+139xzv3-47/85yzv3-103/43z2v3+48/97xuv3+67/15yuv3-69/95zuv3-67/90u2v3+6540xv4+6276yv4-9756zv4-10/121uv4+118/63v5,x5+13/23x4y-10277x3y2-81/107x2y3+18/97xy4+193x4z-206x3yz+1473x2y2z-3907xy3z+9620y4z-11603x3z2+7430x2yz2-3745xy2z2-23/55y3z2-31/13x2z3-115/51xyz3+54/5y2z3+107/6xz4+8432yz4-23/71z5-21/79x4u-7130x3yu-55/46x2y2u+61/113xy3u+11/95y4u-31/125x3zu+47/80x2yzu+12/79xy2zu-51/112y3zu-28/75x2z2u+1962xyz2u-12942y2z2u-93/37xz3u-7/9yz3u+81/7z4u-79/62x3u2+98/29x2yu2-113/36xy2u2-59/51y3u2-5931x2zu2+8/29xyzu2-22/117y2zu2-12146xz2u2+12607yz2u2-8748z3u2-11878x2u3-6xyu3-11798y2u3+97/111xzu3+122/3yzu3+10228z2u3-99/67xu4-8058yu4+116/43zu4-6801u5-7565x4v-21/58x3yv-23/90x2y2v-111/49xy3v+62/3y4v-118/109x3zv-91/27x2yzv-2256xy2zv-6909y3zv+47/126x2z2v+397xyz2v-65/103y2z2v+106/43xz3v-43/9yz3v+4502z4v+5383x3uv-19/48x2yuv+91/92xy2uv-15545y3uv+11204x2zuv+7609xyzuv-125/44y2zuv+15/7xz2uv-4157yz2uv+27/10z3uv+70/67x2u2v+5/121xyu2v-12337y2u2v-12417xzu2v+46/113yzu2v+27/89z2u2v-9419xu3v-59/47yu3v+52/97zu3v+71/56u4v+56/123x3v2+122/73x2yv2+100/103xy2v2+43/8y3v2+99/98x2zv2-14242xyzv2-93/38y2zv2+61/109xz2v2-21/125yz2v2+80/23z3v2+11603x2uv2-1734xyuv2-55/73y2uv2+5/89xzuv2+77/100yzuv2-71/38z2uv2+41/47xu2v2+981yu2v2+11/41zu2v2-8983u3v2+98/59x2v3+105/97xyv3-6372y2v3+12829xzv3+79/96yzv3+110/57z2v3+8495xuv3-11228yuv3-2396zuv3-101/9u2v3-71/39xv4-11746yv4-43/96zv4+64/55uv4-769v5,122/49x4y+3959x3y2+7277x2y3-41/93xy4-39/59y5+32/97x4z+97/96x3yz-43/116x2y2z+19/30xy3z+18/17y4z+39/122x3z2-98/99x2yz2+23/65xy2z2-50/103y3z2-11445x2z3+111/119xyz3-82/67y2z3+49/15xz4+59/74yz4+87/124z5+97/113x3yu+59/113x2y2u-17/16xy3u-1892y4u-15886x3zu+75/124x2yzu-13/108xy2zu+14203y3zu+13871x2z2u+24xyz2u+1483y2z2u-34/91xz3u+51/29yz3u+88/107z4u+6268x2yu2+13776xy2u2+1935y3u2-9062x2zu2-4534xyzu2+9553y2zu2-8429xz2u2-11141yz2u2-89/88z3u2-79/50xyu3-121/15y2u3-7891xzu3-27/94yzu3+96/71z2u3+27/53yu4+15307zu4-775x4v-2648x3yv-2095x2y2v+7594xy3v+12989y4v-17/29x3zv+11801x2yzv+32/45xy2zv-55/73y3zv+9756x2z2v+6886xyz2v+5939y2z2v+39/23xz3v+2632yz3v+77/6z4v+36/121x3uv-76/55x2yuv+5296xy2uv-32/47y3uv-125/84x2zuv-30/67xyzuv-14914y2zuv+73/23xz2uv+123/101yz2uv+49/43z3uv-76/71x2u2v+79/50xyu2v+38/7y2u2v-5262xzu2v-5211yzu2v+2/95z2u2v-3570xu3v-9280yu3v+32/91zu3v+1089u4v-73/33x3v2-3931x2yv2-21/113xy2v2+191y3v2-93/2x2zv2-75/47xyzv2+16/115y2zv2+120/23xz2v2+23/114yz2v2-115/108z3v2-103/12x2uv2+20/107xyuv2+28/11y2uv2+23/42xzuv2-15290yzuv2+3651z2uv2-9566xu2v2-113/68yu2v2+7705zu2v2-12261u3v2+9882x2v3-8520xyv3+14858y2v3+200xzv3+14/73yzv3+45/53z2v3-4/113xuv3-11327yuv3+59/51zuv3-13869u2v3-33/29xv4-13026yv4+4236zv4+10782uv4+2817v5,-123/61x4y+4/87x3y2-15558x2y3+78/5xy4-31/83y5+10267x4z-29/21x3yz+2197x2y2z-57/98xy3z+121/31y4z-1310x3z2+9386x2yz2-37/50xy2z2-1767y3z2-489x2z3-117/31xyz3+13576y2z3-50/9xz4-47/77yz4+53/89z5-57/11x4u-8374x3yu+104/103x2y2u+29/12xy3u+7368y4u+102/37x3zu+10508x2yzu+28xy2zu-14484y3zu-240x2z2u-115/114xyz2u+97/74y2z2u+105/11xz3u+125/46yz3u-6746z4u+3454x3u2+14656x2yu2-82/111xy2u2+13130y3u2+121/58x2zu2-42/11xyzu2-89/81y2zu2+68/49xz2u2+8243yz2u2-11615z3u2-40/87x2u3+80/39xyu3+14735y2u3+10706xzu3-2448yzu3+64/51z2u3+4514xu4+658yu4-39/49zu4+21/23u5+11/105x4v-108x3yv-31/98x2y2v-73/64xy3v+205y4v-15348x3zv-13734x2yzv-52/11xy2zv+5897y3zv+106/27x2z2v+9613xyz2v+81/59y2z2v+1172xz3v+3716yz3v-3581z4v+50x3uv+81/38x2yuv+84/109xy2uv-34/69y3uv-58/35x2zuv-23/105xyzuv+43/78y2zuv-57/31xz2uv+98/37yz2uv+11/96z3uv+147x2u2v+11414xyu2v+5/96y2u2v+19/77xzu2v+1274yzu2v+4/63z2u2v-4396xu3v+7060yu3v+5044zu3v-102/121u4v+67/25x3v2-13601x2yv2+68/65xy2v2+82/77y3v2-8394x2zv2-13318xyzv2+71/104y2zv2-75/107xz2v2+39/100yz2v2+11229z3v2+113/84x2uv2-2988xyuv2-9616y2uv2-41/50xzuv2+3/34yzuv2-12322z2uv2-120/11xu2v2+4/75yu2v2+12562zu2v2-92/39u3v2+1497x2v3+80/103xyv3+15/64y2v3-16/109xzv3-85/81yzv3-52/81z2v3-23/49xuv3+1295yuv3+13460zuv3+52/73u2v3-24/5xv4+11079yv4-25/57zv4-119/47uv4-7/120v5,123/61x4z-4/87x3yz+15558x2y2z-78/5xy3z+31/83y4z-2966x3z2+73/89x2yz2+75/112xy2z2+51/29y3z2-46/47x2z3+3812xyz3-8592y2z3+7582xz4+113/92yz4-11815z5+34/111x3zu-25/63x2yzu+115/79xy2zu+36/115y3zu-17/38x2z2u+7906xyz2u-108/71y2z2u+7541xz3u-12683yz3u-111/110z4u-107/24x2zu2-70/9xyzu2+42/113y2zu2-75xz2u2+64/101yz2u2+65/106z3u2-118/97xzu3+12960yzu3-918z2u3-72/113zu4+17/73x4v+15/17x3yv-22/91x2y2v+78/121xy3v+9/77y4v-91/102x3zv+15814x2yzv-12480xy2zv+1177y3zv-7/40x2z2v+47/69xyz2v-2847y2z2v+987xz3v-1954yz3v+43/97z4v-7692x3uv-109/44x2yuv-94/111xy2uv+84/17y3uv+13682x2zuv+64/7xyzuv-13069y2zuv+92/67xz2uv-109/84yz2uv-93/56z3uv-5368x2u2v-93/101xyu2v-118/43y2u2v-40/57xzu2v-58/55yzu2v+84/19z2u2v+4/9xu3v-540yu3v+11588zu3v-93/25u4v-85/89x3v2-1800x2yv2-40/51xy2v2-7293y3v2+15927x2zv2-33/106xyzv2+25/98y2zv2-13657xz2v2+43/37yz2v2+79/115z3v2-74/11x2uv2+29/114xyuv2-50/69y2uv2+252xzuv2-65/69yzuv2-88/5z2uv2+4418xu2v2-6634yu2v2-9854zu2v2-20/73u3v2+94/11x2v3+1430xyv3+1/41y2v3+21/101xzv3-68/59yzv3-9515z2v3+55/8xuv3-12014yuv3+57/73zuv3-97/58u2v3-124/91xv4+5575yv4-5470zv4+15340uv4+123/7v5,-14327x4y-14863x3y2+3913x2y3+4595xy4+75/77y5-5371x3yz+86/123x2y2z-84/115xy3z-117/100y4z-23/37x2yz2-82/125xy2z2+2426y3z2+17/50xyz3+11188y2z3-110/39yz4-126/97x4u-85/41x3yu-22/25x2y2u-10619xy3u+3473y4u-75/52x3zu-121/37x2yzu+48/125xy2zu+7246y3zu-78/49x2z2u+106/3xyz2u-50/59y2z2u-48/23xz3u+79/111yz3u-14913z4u+31/87x3u2+101/84x2yu2-14270xy2u2-116/83y3u2-15/86x2zu2-3946xyzu2+17/23y2zu2+11/2xz2u2-6992yz2u2-118/77z3u2+68/87x2u3-101/70xyu3-5015y2u3-134xzu3-13479yzu3-103/19z2u3-24/61xu4+35/83yu4-15310zu4-10610u5-22/41x4v-120/91x3yv-10964x2y2v-44/31xy3v+65/122y4v-29/47x3zv+2889x2yzv+43/63xy2zv-47/9y3zv+14/41x2z2v-58/57xyz2v-67/9y2z2v+20/33xz3v+32/87yz3v-113/114z4v+31/19x3uv-7367x2yuv+11612xy2uv-27/62y3uv-47/2x2zuv-28/15xyzuv-6682y2zuv+14672xz2uv+4043yz2uv-2529z3uv-39/115x2u2v+17/4xyu2v+49/39y2u2v+15437xzu2v+91/40yzu2v+14140z2u2v-18/107xu3v-49/5yu3v-88/115zu3v-77/82u4v+1398x3v2+7/111x2yv2+1081xy2v2+6822y3v2-19/100x2zv2-19/9xyzv2+116/83y2zv2+123xz2v2-37/54yz2v2+83/32z3v2-23/82x2uv2-17/45xyuv2-10206y2uv2+20/11xzuv2-29/43yzuv2-61/77z2uv2-15878xu2v2-39/44yu2v2+19/41zu2v2+35/88u3v2+2955x2v3-87/115xyv3-16/17y2v3-107/34xzv3+80/91yzv3+112/69z2v3+109/107xuv3+85/28yuv3-68/121zuv3+2654u2v3-64/55xv4-37/60yv4+69/7zv4+66/85uv4+5754v5,-36/35x4u+12883x3yu+49/120x2y2u-4628xy3u-75/118y4u+65/93x3zu+5754x2yzu-41/62xy2zu+328y3zu-43/49x2z2u+98/107xyz2u+9/16y2z2u+15504xz3u-94/39yz3u-7028z4u-74/81x3u2+3486x2yu2+110/31xy2u2+7609y3u2-17/113x2zu2-71/78xyzu2-49/102y2zu2-2012xz2u2-4935yz2u2+459z3u2+6/53x2u3-12342xyu3-4432y2u3-95/23xzu3+11567yzu3+23/84z2u3-78/19xu4+57/10yu4+37/92zu4+11049u5-70/83x4v-34/69x3yv-9309x2y2v+10247xy3v-119/89y4v-13641x3zv+7018x2yzv+33/95xy2zv+8545y3zv+8410x2z2v-119/33xyz2v-31/44y2z2v-15/79xz3v+49/2yz3v+15796z4v-8/61x3uv-4248x2yuv+1419xy2uv-7061y3uv-12022x2zuv+5656xyzuv+101/51y2zuv-6255xz2uv+8208yz2uv-25/31z3uv-55/64x2u2v+35/88xyu2v+7627y2u2v-15213xzu2v-125/47yzu2v+716z2u2v-13163xu3v-12319yu3v+9945zu3v-122/123u4v-55/112x3v2-14498x2yv2-8389xy2v2+31/24y3v2-48/61x2zv2-10781xyzv2-51/43y2zv2-47/38xz2v2+73/88yz2v2+3185z3v2+41/11x2uv2+53/15xyuv2+35/94y2uv2-2/81xzuv2-109/55yzuv2-12412z2uv2+8/67xu2v2-79/101yu2v2+61/76zu2v2-119/47u3v2+100/7x2v3-56/81xyv3+21/82y2v3+87/52xzv3-85/57yzv3-13804z2v3-106/31xuv3+12534yuv3-93/7zuv3-14/27u2v3+85/11xv4-13639yv4-119/76zv4+59/111uv4-3220v5,975x4y+104/33x3y2-106/65x2y3+66/23xy4+59/86y5+73/72x3yz+33/92x2y2z+41/19xy3z-14775y4z-99/23x2yz2+3753xy2z2+71/41y3z2-92/5xyz3+6199y2z3+125yz4-5129x4u+112/123x3yu+19/2x2y2u-2647xy3u-35/89y4u-31/54x3zu+72/37x2yzu-121/52xy2zu-111/68y3zu+3697x2z2u+128xyz2u+14200y2z2u-27/53xz3u+59/78yz3u-22/45z4u-123/38x3u2+102/53x2yu2-49/57xy2u2+5449y3u2-2572x2zu2+3/2xyzu2+9486y2zu2+6/125xz2u2+45/2yz2u2-19/55z3u2-14525x2u3+83/18xyu3+123/56y2u3-12494xzu3-15240yzu3-28/117z2u3-20/93xu4-10552yu4-79/50zu4+107/33u5-11945x4v-86/85x3yv-115/62x2y2v+1874xy3v+96/13y4v+11797x3zv+15569x2yzv+6118xy2zv-106/103y3zv+117/40x2z2v+13729xyz2v-4329y2z2v+2102xz3v-77/27yz3v-73/25z4v+79/50x3uv+115/58x2yuv-1/111xy2uv-14589y3uv-10733x2zuv-83/65xyzuv+1735y2zuv-104/31xz2uv+99/97yz2uv+23/60z3uv+4021x2u2v+15801xyu2v+4183y2u2v-173xzu2v-100/51yzu2v-79/123z2u2v-8262xu3v-9744yu3v+28/37zu3v+5/111u4v-91/124x3v2+100/123x2yv2+113/96xy2v2-67/50y3v2+101/6x2zv2+3452xyzv2+9281y2zv2+53/22xz2v2-4861yz2v2+8899z3v2+91/23x2uv2+13924xyuv2-4/75y2uv2+59/4xzuv2-214yzuv2-114/49z2uv2+14285xu2v2+85/27yu2v2-99/5zu2v2-74/33u3v2+8313x2v3-96/71xyv3+41/69y2v3-97/31xzv3-6935yzv3-102/29z2v3+67/82xuv3+35/9yuv3-33/95zuv3+6316u2v3-6800xv4-93/4yv4-6367zv4+75/56uv4-13460v5;TestGRRes(Name, I); kill R, Name, @p; "";

  string Name = "ell.d10.g9"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = -44/83x3y2-51/22x2y3+104/11xy4+38/119y5+22/87x3yz-27/61x2y2z-49/121xy3z-60/43y4z+124/65x3z2+39/107x2yz2-10379xy2z2-86/125y3z2+33/8x2z3+3501xyz3+53/9y2z3-69/106xz4+441yz4-19/126z5+12584x3yu+21/104x2y2u+12937xy3u-113/108y4u+13758x3zu+4991x2yzu+5360xy2zu-11946y3zu-2442x2z2u-9336xyz2u+9027y2z2u-112/37xz3u+14035yz3u-8230z4u+58/83x3u2+9675x2yu2+29/114xy2u2+10729y3u2+11/23x2zu2+3609xyzu2+7065y2zu2-2477xz2u2+32/37yz2u2-109/89z3u2-68/109x2u3-107/45xyu3-65/53y2u3+12249xzu3-11480yzu3+4/119z2u3+4418xu4+11875yu4-6961zu4+2678u5-76/71x3yv-87/4x2y2v+119/27xy3v+20/31y4v+122/65x3zv-116/61x2yzv-10976xy2zv-5720y3zv-12559x2z2v-109/102xyz2v-123/121y2z2v-18/73xz3v-89/124yz3v-50/109z4v-113/50x3uv+31/79x2yuv-14121xy2uv+11/123y3uv-3754x2zuv-1676xyzuv-117/113y2zuv-11336xz2uv-35/44yz2uv-116/21z3uv+10245x2u2v+17/4xyu2v-6432y2u2v-12632xzu2v+80/47yzu2v-9/115z2u2v-2607xu3v-79/82yu3v-71/63zu3v+71/102u4v-5212x3v2-2079x2yv2+104/107xy2v2+50/19y3v2+14719x2zv2-7/115xyzv2-113/6y2zv2+123/100xz2v2+22/9yz2v2+15772z3v2-10/111x2uv2-35/52xyuv2-8041y2uv2-17/38xzuv2-11677yzuv2+54/67z2uv2+7941xu2v2-8500yu2v2-147zu2v2-101/68u3v2+7864x2v3-120/61xyv3+13984y2v3+81/101xzv3-79/20yzv3-95/7z2v3-19/89xuv3-5837yuv3+112/95zuv3+119/87u2v3-51/50xv4-85/16yv4+3/44zv4+5109uv4-9320v5,44/83x4y+7230x3y2-110/69x2y3+5570xy4+87y5-103/18x4z+93/70x3yz+75/37x2y2z-61xy3z+7367y4z+5/31x3z2+9111x2yz2-97/44xy2z2+28/55y3z2+89/12x2z3+1832xyz3-15162y2z3+81/100xz4+52/9yz4-3/17z5+23/118x4u+101/55x3yu-33/47x2y2u-149xy3u+7961y4u-7891x3zu-81/14x2yzu+10246xy2zu+51/125y3zu+43/64x2z2u-68/37xyz2u+11/5y2z2u+5578xz3u-5440yz3u+61/118z4u-4318x3u2-69x2yu2-15141xy2u2+12/13y3u2+12180x2zu2-67/6xyzu2-18/121y2zu2+738xz2u2-91/115yz2u2+105/8z3u2-14085x2u3-5451xyu3+91/79y2u3-43/113xzu3-36/11yzu3-89/122z2u3+101/59xu4-125/117yu4-113/25zu4+63/118u5+13/106x4v+11326x3yv+2583x2y2v+14291xy3v+11795y4v-9923x3zv+10823x2yzv+30/31xy2zv-6558y3zv+89/20x2z2v-111/109xyz2v+10420y2z2v-81/44xz3v-76/3yz3v-31/55z4v+3423x3uv+47/80x2yuv-7843xy2uv-15365y3uv+978x2zuv+73/24xyzuv-2/39y2zuv-28/75xz2uv+1849yz2uv-10885z3uv+120/91x2u2v+9293xyu2v-8837y2u2v+109/105xzu2v+7/93yzu2v+4076z2u2v-106/5xu3v+8053yu3v-90zu3v+8598u4v+81/76x3v2-103/42x2yv2-6873xy2v2+49/73y3v2+8447x2zv2+3846xyzv2+107/126y2zv2+2145xz2v2+53/105yz2v2-62/75z3v2-11/35x2uv2+7066xyuv2+69/59y2uv2-53/64xzuv2+8587yzuv2+58/125z2uv2-15386xu2v2+9/121yu2v2+14966zu2v2-2518u3v2-37/56x2v3-11840xyv3-23/47y2v3+110/81xzv3-81yzv3+2719z2v3-65/118xuv3-1221yuv3-33/82zuv3-106/15u2v3+39/112xv4+13479yv4-126/109zv4-2251uv4+8907v5,-10723x3yz+16/79x2y2z+62/49xy3z-5204y4z-49/3x3z2+91/71x2yz2+77/3xy2z2-88/43y3z2-13949x2z3-9045xyz3+109/16y2z3-89/62xz4-15674yz4-10313z5-6773x3yu+124/61x2y2u-7483xy3u+18/23y4u-5136x3zu-3/31x2yzu-11796xy2zu-56/57y3zu-68/95x2z2u-7917xyz2u+1349y2z2u-17/56xz3u+14713yz3u-7938z4u+3104x3u2+14197x2yu2-15411xy2u2-14704y3u2+24/77x2zu2+78/19xyzu2-23/51y2zu2+98/61xz2u2+60/71yz2u2-103/51z3u2-103/42x2u3+15/79xyu3+101/62y2u3-15165xzu3+83/5yzu3-61/60z2u3+7/78xu4-3907yu4+6635zu4-12205u5-388x3yv+63/59x2y2v+88/109xy3v-13978y4v+80/53x3zv+645x2yzv+117/25xy2zv-81/53y3zv+43/72x2z2v+27/8xyz2v-10620y2z2v-13547xz3v-8282yz3v+13426z4v-58/119x3uv+480x2yuv-15697xy2uv-25/58y3uv-115x2zuv-46/123xyzuv-22/13y2zuv-88/105xz2uv-111/62yz2uv+3415z3uv-117/77x2u2v+18/29xyu2v-80/91y2u2v+7851xzu2v-11079yzu2v+39/50z2u2v+14917xu3v+1131yu3v+13259zu3v-122/25u4v-109/37x3v2+7/78x2yv2-73/13xy2v2-5623y3v2+11389x2zv2+63/68xyzv2+28/27y2zv2+69/112xz2v2-10851yz2v2+15829z3v2+86/51x2uv2+2298xyuv2+17/103y2uv2-97/2xzuv2+1/5yzuv2-104/119z2uv2+2/95xu2v2+11655yu2v2-42/65zu2v2+37/26u3v2-12355x2v3+35xyv3+20/7y2v3+8032xzv3+9572yzv3+11508z2v3+10858xuv3+115/81yuv3+10973zuv3+10832u2v3+33/101xv4-71/88yv4+67/18zv4-15473uv4+11/107v5,-28/81x3y2-126/61x2y3-70/23xy4+14521y5-3/55x3yz-100/107x2y2z-10724xy3z+2013y4z+1241x3z2+61/104x2yz2+3577xy2z2-2748y3z2-15718x2z3+106/5xyz3-41/93y2z3-95/61xz4-1/30yz4-73/4z5-59/56x3yu-14867x2y2u-11840xy3u+7444y4u-38/41x3zu-153x2yzu-2654xy2zu+73/83y3zu+6940x2z2u-1241xyz2u+79/17y2z2u-39/35xz3u-4590yz3u+8/109z4u+73/34x3u2+15609x2yu2+12721xy2u2-95/31y3u2+33/14x2zu2+77/65xyzu2-14476y2zu2+73/101xz2u2-73/101yz2u2+92/5z3u2-71/94x2u3-97/33xyu3+125/82y2u3+10213xzu3-6039yzu3-87/61z2u3-14084xu4-43/7yu4+3169zu4+4248u5+100/101x3yv+624x2y2v-4023xy3v-87/65y4v-2971x3zv-8/21x2yzv+8171xy2zv-7776y3zv-55/104x2z2v+96/113xyz2v-7318y2z2v+9436xz3v+42/41yz3v-115/14z4v-2550x3uv+82/29x2yuv+3830xy2uv+71/97y3uv-98/67x2zuv-4319xyzuv+33/49y2zuv-123/49xz2uv-35/62yz2uv-85/6z3uv-10726x2u2v+98/85xyu2v+24/43y2u2v-1382xzu2v+39/109yzu2v-36/71z2u2v+15911xu3v-38/35yu3v+2079zu3v+123/29u4v+4369x3v2-59/126x2yv2-11066xy2v2+110/117y3v2+14815x2zv2-19/49xyzv2-29/10y2zv2+41/38xz2v2-96/55yz2v2+686z3v2+67/30x2uv2+123/23xyuv2-52/25y2uv2-55xzuv2-23/89yzuv2-89/77z2uv2+9906xu2v2-12766yu2v2-104/7zu2v2+6533u3v2-65/97x2v3+57/2xyv3-11084y2v3+13/81xzv3-23/7yzv3-122/111z2v3+224xuv3+5112yuv3+103/30zuv3+78/43u2v3+4811xv4+6171yv4-3422zv4-1589uv4-5541v5,28/81x4y-39/88x3y2-101/87x2y3+11/10xy4+29/44y5-21/94x4z-100/81x3yz+123/73x2y2z+5440xy3z-15190y4z+14140x3z2+74/27x2yz2+92/15xy2z2+8048y3z2-95/64x2z3-60/89xyz3-11/118y2z3+56/15xz4+102/31yz4-1571z5-2598x4u-4426x3yu+2148x2y2u-95/11xy3u-6701y4u-12741x3zu-1179x2yzu+1671xy2zu-93/10y3zu-77/78x2z2u-35/101xyz2u-41/89y2z2u+1556xz3u+13/121yz3u+1288z4u-53/89x3u2-3/109x2yu2-12018xy2u2-5219y3u2+86/49x2zu2-1/84xyzu2+86/113y2zu2-85/123xz2u2+94/85yz2u2-10590z3u2-99/38x2u3+2696xyu3+107/13y2u3-144xzu3+8/69yzu3-107/33z2u3-117/53xu4+1924yu4+75/7zu4+98/113u5+13120x4v-7308x3yv+49/85x2y2v+55/64xy3v-4634y4v+9344x3zv-126/121x2yzv+23/81xy2zv+5086y3zv-4215x2z2v+2442xyz2v-9336y2z2v-43/44xz3v+114/109yz3v+10963z4v-2/111x3uv-5/126x2yuv-41/56xy2uv+47/79y3uv+74x2zuv-15011xyzuv+11187y2zuv-104/115xz2uv-94/67yz2uv+6674z3uv-5/78x2u2v-123/79xyu2v+7/36y2u2v+79/97xzu2v-55/62yzu2v-121/3z2u2v+109/4xu3v+9102yu3v-9526zu3v+8388u4v-47/98x3v2+14967x2yv2+5139xy2v2+83/16y3v2-15926x2zv2+8971xyzv2-15679y2zv2+8686xz2v2+13783yz2v2-57/103z3v2-73/100x2uv2-106/119xyuv2-98/113y2uv2+12096xzuv2+14898yzuv2+115/61z2uv2-125/119xu2v2+6048yu2v2+1/102zu2v2+31/125u3v2+7/27x2v3+64/123xyv3+2569y2v3+113/96xzv3-7216yzv3+2236z2v3-7127xuv3-38/17yuv3+94/73zuv3+708u2v3+87/88xv4-15428yv4-41/64zv4-55/86uv4-41/89v5,109/21x3yz-8388x2y2z-17/10xy3z-14404y4z+12672x3z2+73/52x2yz2+13291xy2z2+118/57y3z2+6159x2z3+4294xyz3-35/92y2z3-55/116xz4+83/64yz4-40/81z5-21/88x3yu-23/58x2y2u+83/118xy3u+12766y4u-45/101x3zu-38/71x2yzu+13/14xy2zu+50y3zu-2123x2z2u-61/102xyz2u+7/111y2z2u+48/121xz3u-15030yz3u-16/21z4u-34/121x3u2+34/111x2yu2+7/48xy2u2+1018y3u2-90/71x2zu2+10585xyzu2-117/56y2zu2+15739xz2u2-37/123yz2u2+4841z3u2-3527x2u3+107/77xyu3+14476y2u3-53/14xzu3-44/41yzu3+83/99z2u3+57/83xu4+1763yu4+3291zu4-2214u5+4710x3yv+4019x2y2v+106/103xy3v-33/67y4v-65/74x3zv-19/36x2yzv+83/97xy2zv+3597y3zv+76/25x2z2v-2159xyz2v+73/67y2z2v-68/55xz3v+36/29yz3v+96/55z4v-7809x3uv-101/51x2yuv+107/99xy2uv+3452y3uv-32/63x2zuv-61/125xyzuv+700y2zuv+14/45xz2uv-10/27yz2uv-64/109z3uv-12507x2u2v-3286xyu2v-8787y2u2v+11244xzu2v-7142yzu2v+51/52z2u2v-11/15xu3v+14/15yu3v-71/78zu3v+12840u4v+1676x3v2-7/22x2yv2+13461xy2v2+91/17y3v2-211x2zv2+2520xyzv2+37/91y2zv2+57/43xz2v2+79/61yz2v2+126/5z3v2+15390x2uv2+2521xyuv2-9728y2uv2-31/100xzuv2-67/120yzuv2-2/89z2uv2+3/40xu2v2-123/5yu2v2+95/44zu2v2+55/82u3v2+61/73x2v3+4656xyv3-59/61y2v3+53/5xzv3+81/19yzv3+7838z2v3-30xuv3-24/7yuv3-88/67zuv3-97/109u2v3+1/32xv4-7809yv4+115/33zv4+95/9uv4-51/31v5,10723x3yu-16/79x2y2u-62/49xy3u+5204y4u+49/3x3zu-91/71x2yzu-77/3xy2zu+88/43y3zu+13949x2z2u+9045xyz2u-109/16y2z2u+89/62xz3u+15674yz3u+10313z4u+12767x3u2-3679x2yu2+115/94xy2u2-95/72y3u2+83/126x2zu2+3070xyzu2+44/91y2zu2+105/53xz2u2-12618yz2u2-13345z3u2+61/47x2u3+108/25xyu3-3/17y2u3-76/71xzu3-36yzu3+96/47z2u3-7291xu4+7566yu4+1445zu4-48/79u5-4731x3yv+35/38x2y2v+26/47xy3v-6365y4v-15522x3zv+6045x2yzv+121/111xy2zv-15013y3zv+4541x2z2v+12683xyz2v+21/61y2z2v+96/29xz3v+98/57yz3v+57/112z4v+1027x3uv+220x2yuv+63/122xy2uv-6828y3uv+21/92x2zuv-13076xyzuv+4327y2zuv+65/107xz2uv-109/120yz2uv+46/87z3uv-13/102x2u2v+20/61xyu2v-41/47y2u2v-7345xzu2v+125/42yzu2v+124/49z2u2v-118/115xu3v+53/36yu3v-15/56zu3v+107/76u4v-13479x3v2+104/73x2yv2+5583xy2v2+12198y3v2-10858x2zv2+244xyzv2+15876y2zv2-38/123xz2v2+93/122yz2v2+82/15z3v2-35x2uv2-90/103xyuv2-16/73y2uv2+5638xzuv2-39/35yzuv2-82/39z2uv2+39/106xu2v2-3530yu2v2+7014zu2v2-9/16u3v2+105/46x2v3+1/9xyv3-10361y2v3+3039xzv3-5956yzv3+750z2v3-2053xuv3+27/112yuv3+4/121zuv3-13/108u2v3-70/33xv4-115/108yv4-59/61zv4-10442uv4-17/39v5,-80/61x3y2+68/57x2y3-35/101xy4+19/75y5+635x3yz+287x2y2z-31/49xy3z+89/93y4z-20/41x3z2-10544x2yz2+14618xy2z2-92/49y3z2+33/86x2z3-1/121xyz3-9325y2z3+2/67xz4-49/106yz4+15003z5+67/49x3yu-15884x2y2u-11/9xy3u+9349y4u+63/20x3zu+79/25x2yzu-23/77xy2zu+99/20y3zu-8233x2z2u-5/84xyz2u+71/97y2z2u+124/43xz3u-64/101yz3u-13567z4u-59/84x3u2+55/94x2yu2+7962xy2u2+36/95y3u2+5/8x2zu2+104/27xyzu2+59/12y2zu2+8231xz2u2-138yz2u2-8432z3u2+25/37x2u3+19/97xyu3+55/97y2u3+12659xzu3+27/119yzu3-101/6z2u3+69/103xu4-111/124yu4+96/107zu4-97/5u5+11725x3yv+16/105x2y2v-79/16xy3v-43/107y4v+17/54x3zv-12757x2yzv+7/124xy2zv-93/73y3zv+69/22x2z2v+73/40xyz2v+15350y2z2v+108/65xz3v+190yz3v+4395z4v+14431x3uv+8x2yuv+6264xy2uv+38/41y3uv-15601x2zuv-6559xyzuv-4074y2zuv+8619xz2uv+83/28yz2uv+15701z3uv-35/37x2u2v+75/62xyu2v+9293y2u2v-32/123xzu2v-64/15yzu2v+101/106z2u2v-13/111xu3v+89/37yu3v+49/36zu3v-78/125u4v+32/87x3v2-15591x2yv2-637xy2v2+31/61y3v2+39/41x2zv2-15874xyzv2-12988y2zv2+37/109xz2v2-18/119yz2v2-7257z3v2+97/16x2uv2+21/29xyuv2+81/95y2uv2-109/34xzuv2-35/27yzuv2+13439z2uv2-55/81xu2v2-23/90yu2v2-79/37zu2v2-60/103u3v2+41/24x2v3-95/54xyv3-104/25y2v3-27/97xzv3+43/52yzv3+82/65z2v3+15/82xuv3+1/44yuv3+65/119zuv3-5/32u2v3-1039xv4+39/31yv4-2847zv4-35/123uv4+59/20v5,80/61x4y-116/11x3y2-79/103x2y3-10762xy4-67/101y5+83/38x4z+61/10x3yz+31/8x2y2z-107/103xy3z-85/113y4z-3/97x3z2+6296x2yz2+47/86xy2z2+15041y3z2+14353x2z3+1990xyz3+15780y2z3-92/43xz4+64/47yz4-108/7z5+88/49x4u+98/57x3yu-41/44x2y2u+92/119xy3u+43/71y4u+14335x3zu+58/7x2yzu-79/39xy2zu-3487y3zu+56/83x2z2u-75/73xyz2u-7173y2z2u-99/64xz3u-51/65yz3u+11138z4u+8299x3u2+47/116x2yu2+98/95xy2u2+117/53y3u2-123/46x2zu2+125/74xyzu2-82/19y2zu2-4508xz2u2+49/29yz2u2-3337z3u2-109/7x2u3+103/41xyu3+28/13y2u3-6790xzu3-8289yzu3+59/41z2u3+15888xu4-9252yu4+10/99zu4+1485u5-101/23x4v-6626x3yv+19/25x2y2v-73/49xy3v-17/14y4v-33/46x3zv+109/58x2yzv+1/44xy2zv+8/65y3zv+5700x2z2v+16/69xyz2v+18/37y2z2v+3905xz3v+84/95yz3v+83/65z4v-700x3uv-8/7x2yuv+3184xy2uv-8373y3uv+106/115x2zuv+68/125xyzuv-2829y2zuv-38/41xz2uv+101/19yz2uv+66/97z3uv-47/7x2u2v+21/97xyu2v+9/74y2u2v+57/55xzu2v-107/89yzu2v-14157z2u2v-1693xu3v+9/10yu3v-53/114zu3v-10049u4v+9871x3v2+14318x2yv2-8447xy2v2+10730y3v2-98/87x2zv2-3822xyzv2+38/39y2zv2+111/59xz2v2-4603yz2v2+35/69z3v2-161x2uv2-73/48xyuv2-58/79y2uv2+71/63xzuv2+1832yzuv2+7891z2uv2-13900xu2v2+113/31yu2v2-7626zu2v2-1223u3v2-33/94x2v3-49/20xyv3+20/113y2v3-47/15xzv3+109/32yzv3-49/95z2v3+92/17xuv3-16/99yuv3-10817zuv3+3754u2v3-94/9xv4-67/79yv4+12659zv4+101/117uv4+113/17v5,-3756x3yz-24/35x2y2z-29/112xy3z+7944y4z-8968x3z2+62/115x2yz2-38/101xy2z2+28/39y3z2+61/49x2z3-88/119xyz3-119/87y2z3-7/123xz4-4935yz4-1239z5+8x3yu-68/7x2y2u+11910xy3u+5043y4u+7293x3zu-121/47x2yzu+8/77xy2zu-53/109y3zu+15439x2z2u-6359xyz2u-81/109y2z2u-3423xz3u+12246yz3u-1382z4u-2355x3u2+12015x2yu2-79/38xy2u2-14798y3u2+623x2zu2+47/113xyzu2+11457y2zu2+5127xz2u2-9/16yz2u2-70/41z3u2+107/112x2u3-73/49xyu3-38/15y2u3+8748xzu3-5150yzu3-94/67z2u3+10449xu4-993yu4-53/6zu4+46/79u5+59/46x3yv+7/44x2y2v+11979xy3v+78/61y4v+69/109x3zv-424x2yzv+3267xy2zv-82/17y3zv+15/92x2z2v-106/121xyz2v-32/37y2z2v+15746xz3v+97/30yz3v-7/29z4v-9484x3uv+64/45x2yuv-75xy2uv+14513y3uv-11/103x2zuv-82/3xyzuv+8740y2zuv-67/101xz2uv+584yz2uv+15/121z3uv+11669x2u2v+51/112xyu2v+124/101y2u2v+106/17xzu2v+3108yzu2v-67/118z2u2v+6866xu3v+5705yu3v-68/77zu3v-89/98u4v+14035x3v2-1896x2yv2+107/99xy2v2+46/49y3v2+109/29x2zv2-14831xyzv2-13871y2zv2+61/62xz2v2-35/9yz2v2+61/40z3v2+101/115x2uv2-14723xyuv2+13811y2uv2+66/13xzuv2-9031yzuv2-118/77z2uv2-86/121xu2v2-10616yu2v2-60/107zu2v2+123/85u3v2-92/47x2v3+23/98xyv3-5986y2v3-8636xzv3+63/89yzv3+1899z2v3+117/19xuv3-65/41yuv3+2817zuv3-1578u2v3-35/82xv4+2155yv4+7844zv4-40/67uv4-16/111v5,-4394x3y2-8801x2y3+12722xy4+15341y5+85/73x3yz+3786x2y2z-156xy3z-11841y4z-93/47x3z2+79/20x2yz2+79/99xy2z2+10343y3z2-631x2z3+7178xyz3-4119y2z3+15660xz4+14318yz4+1/69z5-9/85x3yu-59/33x2y2u-4250xy3u-9233y4u-103/75x3zu-72/53x2yzu+50/7xy2zu+6476y3zu-37/114x2z2u-5/7xyz2u-13/93y2z2u+7262xz3u+40/93yz3u-5837z4u-13/116x3u2+12622x2yu2+2615xy2u2-235y3u2+99/115x2zu2+101/9xyzu2+83/28y2zu2+14490xz2u2+119/96yz2u2-11229z3u2+41/86x2u3+14636xyu3-88/45y2u3-9311xzu3-8967yzu3-71/105z2u3+56/53xu4+14093yu4+115zu4+118/67u5-95/54x3yv-11922x2y2v-101/117xy3v-15245y4v-3849x3zv+100x2yzv+101/64xy2zv+82/5y3zv-53/52x2z2v-26/67xyz2v+17/72y2z2v+33/41xz3v-91/82yz3v-29/12z4v+73/126x3uv+109/73x2yuv-28/55xy2uv-51/29y3uv+17/35x2zuv+108/67xyzuv+81/2y2zuv+95/101xz2uv-57/8yz2uv-7142z3uv-8230x2u2v-91/107xyu2v-51/11y2u2v+67/125xzu2v-59/17yzu2v+23/121z2u2v+14520xu3v+2632yu3v+10602zu3v+19/75u4v-98/115x3v2-13270x2yv2+23/28xy2v2-97/24y3v2+18/37x2zv2+2394xyzv2+9634y2zv2-12683xz2v2-4723yz2v2+93/11z3v2+76/15x2uv2-7066xyuv2-3496y2uv2-31/33xzuv2+23/114yzuv2+75/4z2uv2+6637xu2v2+5/31yu2v2-220zu2v2-15145u3v2-16/57x2v3+994xyv3+13/111y2v3-35/111xzv3-1460yzv3-13818z2v3-12748xuv3+6/19yuv3+3481zuv3+4768u2v3+31/83xv4-21/34yv4-117/95zv4+7890uv4-5747v5,4394x4y+25/118x3y2+27/122x2y3-1/20xy4-21/58y5+7367x4z+11281x3yz+2518x2y2z-55/92xy3z+7/17y4z-6716x3z2+116/11x2yz2+67/35xy2z2+14506y3z2-70/17x2z3-92/125xyz3-11235y2z3+28/79xz4+6770yz4+13311z5-12323x4u-36x3yu-74/35x2y2u+28/11xy3u-14140y4u+29/76x3zu+10357x2yzu-13657xy2zu-65/9y3zu+8/49x2z2u-186xyz2u+7854y2z2u+20/111xz3u+53/20yz3u-4420z4u-49x3u2+106/73x2yu2-57/112xy2u2-1767y3u2-67/36x2zu2+97/31xyzu2-4/15y2zu2-27/119xz2u2-6837yz2u2+81/88z3u2-803x2u3-14237xyu3+116/45y2u3+74/53xzu3-44/23yzu3+7957z2u3+2551xu4-5262yu4-3014zu4+115/98u5+46/39x4v+71/2x3yv+13841x2y2v-12/7xy3v+7491y4v+19/67x3zv-21/82x2yzv+29/92xy2zv+124/123y3zv+4436x2z2v+4318xyz2v-14/111y2z2v+105/118xz3v+12883yz3v-105/22z4v-124/109x3uv-107/103x2yuv+7/4xy2uv-114/121y3uv-74/69x2zuv-5025xyzuv-114/97y2zuv-5872xz2uv+24/95yz2uv-49/88z3uv-21/29x2u2v+121/52xyu2v+721y2u2v+119/67xzu2v+85/48yzu2v+50/67z2u2v+24/53xu3v+32/115yu3v-2809zu3v+2966u4v+5211x3v2-190x2yv2+2551xy2v2+2895y3v2+124/63x2zv2-6160xyzv2+71/122y2zv2+8635xz2v2-9/28yz2v2+193z3v2+9/119x2uv2-110/101xyuv2-11713y2uv2-6363xzuv2+61/93yzuv2-10139z2uv2+89/96xu2v2+94/103yu2v2+61/93zu2v2-61/78u3v2-67/22x2v3+15674xyv3-121/5y2v3+121/76xzv3+15523yzv3-93/88z2v3+8667xuv3-11344yuv3-97/108zuv3-14490u2v3+10228xv4-18/107yv4-54/37zv4-2193uv4+14370v5,-103/79x3yz-16/41x2y2z+114/83xy3z-104/85y4z+14/37x3z2-3023x2yz2+723xy2z2-7/55y3z2-82/85x2z3-33/83xyz3+109/119y2z3-13119xz4-4627yz4-35/37z5-11662x3yu+121/57x2y2u-7212xy3u+59/83y4u+2149x3zu-30/13x2yzu+125/119xy2zu+79/23y3zu-3/88x2z2u+7168xyz2u-10717y2z2u+112/33xz3u-10509yz3u+121/56z4u+125/88x3u2-115/121x2yu2+49/4xy2u2-27/88y3u2-2867x2zu2-43/85xyzu2-4734y2zu2-37/114xz2u2-2/43yz2u2+106/95z3u2-108/35x2u3+4531xyu3-19/44y2u3-73/27xzu3+59/117yzu3+25/9z2u3-65/89xu4+81/20yu4+5365zu4+1733u5-2363x3yv-10326x2y2v-5/24xy3v-17/106y4v-14412x3zv+6361x2yzv+10187xy2zv-76/101y3zv+4991x2z2v+14252xyz2v-107/18y2z2v+4857xz3v-13162yz3v+1088z4v-3/64x3uv-14/113x2yuv+96/41xy2uv-76/103y3uv+8924x2zuv-11/30xyzuv-4493y2zuv+3070xz2uv+10/41yz2uv-35/51z3uv+4318x2u2v+15309xyu2v+107/101y2u2v-1748xzu2v+11082yzu2v+29/90z2u2v-19/8xu3v+107/64yu3v+3039zu3v-21/59u4v+14/87x3v2+16/59x2yv2+77/9xy2v2+3679y3v2+53/113x2zv2+97/80xyzv2-899y2zv2+10016xz2v2-10049yz2v2+29/10z3v2+43/7x2uv2-5919xyuv2-7/34y2uv2+42/85xzuv2+102/23yzuv2-8300z2uv2+125/2xu2v2-1700yu2v2-107/21zu2v2+12942u3v2-3054x2v3-87/53xyv3+4745y2v3+52/83xzv3-11747yzv3-119/64z2v3-5987xuv3+2016yuv3-2889zuv3+4535u2v3-1588xv4-27/5yv4+8541zv4-15581uv4-3/119v5,-x3y2-7492x2y3+118/35xy4-43/5y5-2479x3yz-8522x2y2z-105/26xy3z-103/18y4z+5868x3z2-10040x2yz2-50/81xy2z2+3378y3z2-71/44x2z3-12323xyz3-25/44y2z3+12979xz4-15146yz4+5962z5+8852x3yu-39/77x2y2u-9554xy3u-14590y4u+61/84x3zu-2295x2yzu-5969xy2zu+14241y3zu-29/74x2z2u+107/17xyz2u+107y2z2u-14/99xz3u+109/93yz3u-73/41z4u-9170x3u2+8877x2yu2-109/118xy2u2+65/36y3u2+122/93x2zu2-15020xyzu2+33/50y2zu2-11/46xz2u2-91/116yz2u2-47/10z3u2-34/57x2u3-90/79xyu3+12760y2u3+81/71xzu3+1436yzu3+14839z2u3+6598xu4-12418yu4-47/59zu4-1357u5+6/91x3yv-46/21x2y2v+100/53xy3v-69/125y4v+98x3zv-63/23x2yzv+96/121xy2zv+12/11y3zv-37/120x2z2v-37/106xyz2v-25/122y2z2v-13657xz3v+79/47yz3v+15519z4v+45/46x3uv+73/100x2yuv-5361xy2uv-39/101y3uv+1161x2zuv-105/22xyzuv+79/34y2zuv+96/31xz2uv-20/51yz2uv-2683z3uv-122/125x2u2v-66/109xyu2v-6357y2u2v-3021xzu2v+86/33yzu2v-105/8z2u2v+95/22xu3v-9046yu3v+69/83zu3v-3166u4v+91/115x3v2+9661x2yv2-8757xy2v2+79/23y3v2+125/107x2zv2+6133xyzv2+8975y2zv2-38/103xz2v2-120/43yz2v2+59/124z3v2-9252x2uv2+27/64xyuv2+99/80y2uv2+125/28xzuv2-60/109yzuv2-73/107z2uv2-15162xu2v2+91/71yu2v2-89/122zu2v2-1/9u3v2+40/117x2v3-71/41xyv3+10502y2v3-5618xzv3-995yzv3-117/112z2v3-15185xuv3-4470yuv3-13/4zuv3-14631u2v3-5804xv4-15527yv4-47/87zv4+5084uv4-64/11v5,x4y+46/47x3y2+13/47x2y3-13553xy4-5/59y5-15/76x4z+370x3yz+15/56x2y2z-8199xy3z+17/37y4z+32/47x3z2-26/29x2yz2-1/109xy2z2+68/77y3z2-88/123x2z3-1397xyz3-90y2z3+117/80xz4+14919yz4+11248z5+1742x4u-6060x3yu+97/38x2y2u+54/53xy3u-26/45y4u-315x3zu+9/76x2yzu+113/14xy2zu-28/79y3zu-109/14x2z2u+53/54xyz2u-213y2z2u-18/11xz3u-12129yz3u+6321z4u-13361x3u2+109/81x2yu2+37/84xy2u2-19/69y3u2+82/31x2zu2-20/41xyzu2-13135y2zu2-52/99xz2u2-12942yz2u2-8237z3u2-12377x2u3-41/43xyu3+13143y2u3-6701xzu3-98/53yzu3+97/43z2u3+1570xu4-41/5yu4-7/86zu4+306u5-7920x4v+76/53x3yv-91/73x2y2v-49/64xy3v+12976y4v-1787x3zv-95/123x2yzv-10033xy2zv-83/100y3zv-17/112x2z2v+1060xyz2v-121/54y2z2v+25/77xz3v+23/73yz3v-3576z4v+41/98x3uv+15265x2yuv+9014xy2uv-86/33y3uv-83/51x2zuv-15747xyzuv+11/16y2zuv-12110xz2uv-15554yz2uv-7654z3uv+68/53x2u2v+1673xyu2v-123/64y2u2v-3/19xzu2v+29/34yzu2v-5457z2u2v+51/58xu3v-4242yu3v-70/67zu3v+7159u4v+8620x3v2-9381x2yv2+52/79xy2v2-73/113y3v2+83/22x2zv2-1445xyzv2+6524y2zv2-122xz2v2-107/85yz2v2-1240z3v2+1710x2uv2-101/59xyuv2-2950y2uv2-12343xzuv2-79/27yzuv2-5/26z2uv2+89/68xu2v2-14985yu2v2+8382zu2v2-5109u3v2-12322x2v3-97/106xyv3-86/23y2v3+115/11xzv3-45/2yzv3-79/110z2v3+7472xuv3-17/71yuv3+1659zuv3-4468u2v3-85/47xv4+11/73yv4-1700zv4-32/51uv4+7855v5,62/49x4-125/36x3y+2x2y2+56/39xy3+7307y4-42/43x3z+83/42x2yz-11648xy2z-43/106y3z-49/109x2z2-95/28xyz2-194y2z2+71/95xz3-83/59yz3-66/95z4-1/51x3u-82/21x2yu+121/103xy2u-11106y3u-55/91x2zu+55/119xyzu-123/79y2zu-20/11xz2u+6943yz2u+69z3u+5908x2u2-56/89xyu2-13119y2u2+32/115xzu2+11412yzu2+63/50z2u2+73/85xu3-12527yu3+1991zu3+26/33u4+79/91x3v-10/27x2yv+20/117xy2v-49/102y3v+98/33x2zv+115/76xyzv+12412y2zv-47/48xz2v+121/113yz2v+105/26z3v-10954x2uv+10730xyuv+15721y2uv-101/63xzuv-32/19yzuv+67/71z2uv+77/45xu2v+27/98yu2v-670zu2v-13396u3v-55/119x2v2-7890xyv2-101/7y2v2-9563xzv2+3/95yzv2+4857z2v2+9397xuv2+3/116yuv2-12257zuv2-79/49u2v2+11697xv3+26/19yv3+4885zv3-53/22uv3-8355v4;TestGRRes(Name, I); kill R, Name, @p; "";

  string Name = "k3.d10.g9.quart2"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = x3yz2+31/15x2y2z2-7231xy3z2+99/37y4z2+28/95x3z3+97/32x2yz3+13247xy2z3+12717y3z3-113/31x2z4-61/30xyz4-6844y2z4+104/3xz5-13849yz5+43/39z6+13061x3yzu-8463x2y2zu+94/69xy3zu-8/61y4zu-13297x3z2u+7217x2yz2u-7830xy2z2u-75/14y3z2u+2839x2z3u-14657xyz3u-52/7y2z3u-6/89xz4u-6169yz4u+44/7z5u-98/33x3yu2+41/30x2y2u2-65/98xy3u2+122/13y4u2+9906x3zu2-11587x2yzu2+17/53xy2zu2+6504y3zu2+49/106x2z2u2+11480xyz2u2+97/71y2z2u2+12560xz3u2-114/83yz3u2-13761z4u2-67/112x3u3-18/49x2yu3+21/67xy2u3-44/43y3u3+123/116x2zu3+4459xyzu3-13841y2zu3-805xz2u3-1382yz2u3-5293z3u3+133x2u4-122/79xyu4+9724y2u4+61/24xzu4+113/119yzu4-19/108z2u4+15893xu5+57/22yu5+4600zu5-618u6-27/53x3yzv+44/103x2y2zv-142xy3zv+19/84y4zv+105/8x3z2v+10532x2yz2v-75/74xy2z2v-70/19y3z2v+31/80x2z3v-481xyz3v+47/30y2z3v+14318xz4v+51/28yz4v-15/113z5v-46/17x3yuv-99/100x2y2uv-106/5xy3uv+14384y4uv+7/100x3zuv-15/64x2yzuv-6976xy2zuv+12051y3zuv-67/42x2z2uv-2627xyz2uv-49/104y2z2uv+77/16xz3uv+15766yz3uv+85/117z4uv-107/101x3u2v-6699x2yu2v+2443xy2u2v-27/28y3u2v+11945x2zu2v-14467xyzu2v-4873y2zu2v-63/124xz2u2v-8270yz2u2v+11900z3u2v+47/14x2u3v+53/8xyu3v-10/51y2u3v-87/119xzu3v+114/73yzu3v+86/57z2u3v+52/63xu4v-11587yu4v+1/18zu4v-121/109u5v+116/11x3yv2+19/108x2y2v2-31/3xy3v2-43/9y4v2-81/100x3zv2-7728x2yzv2-1037xy2zv2+24/101y3zv2-61/103x2z2v2-8/51xyz2v2+117/109y2z2v2+98/23xz3v2+1646yz3v2-3356z4v2+105/59x3uv2+117/31x2yuv2+519xy2uv2+12633y3uv2+25/6x2zuv2-963xyzuv2-49/23y2zuv2-116/25xz2uv2+14146yz2uv2+11480z3uv2-95/8x2u2v2-10928xyu2v2-51/23y2u2v2-12770xzu2v2-92/91yzu2v2+3872z2u2v2+3183xu3v2+6871yu3v2+90/37zu3v2+10019u4v2-69/88x3v3-1398x2yv3-97/72xy2v3-46/97y3v3+107/14x2zv3-20/89xyzv3-11367y2zv3+120/29xz2v3-86/81yz2v3+107/69z3v3-39/17x2uv3+83/11xyuv3+169y2uv3-11/71xzuv3-22/17yzuv3-14862z2uv3-13009xu2v3-101/12yu2v3+10617zu2v3+2567u3v3-23/85x2v4+27/50xyv4+113/51y2v4+97/16xzv4+4438yzv4-11857z2v4+14580xuv4-6426yuv4+9421zuv4-10585u2v4+14670xv5+1807yv5+10298zv5-116/53uv5+7869v6,x3yzu+31/15x2y2zu-7231xy3zu+99/37y4zu+28/95x3z2u+97/32x2yz2u+13247xy2z2u+12717y3z2u-113/31x2z3u-61/30xyz3u-6844y2z3u+104/3xz4u-13849yz4u+43/39z5u-124/43x3yu2-90/13x2y2u2-13244xy3u2-78/73y4u2+118/43x3zu2+37/67x2yzu2-10426xy2zu2+2412y3zu2-32/113x2z2u2+35/104xyz2u2+3952y2z2u2+9028xz3u2-1990yz3u2-59/109z4u2+15499x3u3+116/23x2yu3+95/58xy2u3+8/47y3u3+59/109x2zu3-29xyzu3+12412y2zu3+20/81xz2u3+2200yz2u3-13809z3u3+3889x2u4-8136xyu4+8922y2u4-4/121xzu4+82/113yzu4-65/23z2u4+101/53xu5+103/113yu5-99/118zu5-9524u6-2749x3yzv-7814x2y2zv+73/113xy3zv+9937y4zv-59/62x3z2v-23/12x2yz2v-10245xy2z2v+7130y3z2v-4427x2z3v+6656xyz3v+3448y2z3v-46/79xz4v+1611yz4v+8453z5v+12013x3yuv+49/17x2y2uv-4/115xy3uv-121/91y4uv-63/29x3zuv+64/7x2yzuv-8785xy2zuv-87/14y3zuv+36/121x2z2uv+9525xyz2uv+4215y2z2uv-17/13xz3uv-117/125yz3uv+101/122z4uv+42/37x3u2v-8747x2yu2v-105/79xy2u2v+10799y3u2v-58/49x2zu2v-8/75xyzu2v-67/49y2zu2v-38/11xz2u2v+53/27yz2u2v+113/52z3u2v+18/59x2u3v+71/106xyu3v+47/2y2u3v-4594xzu3v+95/4yzu3v-121/46z2u3v-55/62xu4v-101/72yu4v+40/53zu4v+15227u5v-15553x3yv2+29/94x2y2v2-4076xy3v2-7133y4v2+27/125x3zv2+33/29x2yzv2-63/95xy2zv2+9166y3zv2-480x2z2v2+9941xyz2v2+107/46y2z2v2+13018xz3v2+53/98yz3v2+92/35z4v2+17/30x3uv2+77/95x2yuv2+11/67xy2uv2+8262y3uv2+65/11x2zuv2+2567xyzuv2-33/94y2zuv2+85/92xz2uv2+103/25yz2uv2-27/100z3uv2+13210x2u2v2-109/90xyu2v2+141y2u2v2-124/51xzu2v2-3/109yzu2v2-4910z2u2v2+205xu3v2+14357yu3v2+85/57zu3v2-109/28u4v2-68/39x3v3+10545x2yv3-2176xy2v3-8743y3v3+15111x2zv3+25/119xyzv3+8/103y2zv3-6046xz2v3+8658yz2v3+106/5z3v3-31/126x2uv3-7762xyuv3+2315y2uv3+124/67xzuv3-77/104yzuv3+95/71z2uv3+69/119xu2v3+13069yu2v3-8620zu2v3+105/41u3v3-15772x2v4-11212xyv4-61/36y2v4+38/125xzv4-15860yzv4+8/63z2v4+7519xuv4-94/41yuv4+45/32zuv4+9417u2v4-71/35xv5-6287yv5+6481zv5+106/99uv5+3/41v6,-8036x3yu2+7966x2y2u2-151xy3u2-14/111y4u2-111/76x3zu2-102/11x2yzu2+7956xy2zu2-7397y3zu2-113/16x2z2u2-8049xyz2u2+7230y2z2u2+3978xz3u2-36/113yz3u2-8147z4u2-107/83x3u3+78/97x2yu3+12700xy2u3+11/72y3u3+88/31x2zu3-63/40xyzu3+101/35y2zu3-220xz2u3+3/103yz2u3-49/45z3u3-21/113x2u4+104/123xyu4+98/47y2u4-56/61xzu4-87/50yzu4+5913z2u4-120/17xu5+64/11yu5-109/80zu5+10371u6-118/25x3yzv+58/99x2y2zv-5/64xy3zv+7/46y4zv-49/103x3z2v-77/106x2yz2v-44/7xy2z2v-7559y3z2v-17/35x2z3v+948xyz3v-15043y2z3v-3576xz4v-2/109yz4v+74/11z5v+6436x3yuv+7316x2y2uv+29/5xy3uv-1326y4uv+34/49x3zuv-122/27x2yzuv-632xy2zuv+46/49y3zuv-13463x2z2uv-808xyz2uv-17/32y2z2uv-13149xz3uv-117/88yz3uv-45/79z4uv-65/94x3u2v+6/67x2yu2v+34/39xy2u2v-14026y3u2v+42/107x2zu2v-3287xyzu2v-70/43y2zu2v+29/104xz2u2v-47/18yz2u2v-11038z3u2v+6262x2u3v-5255xyu3v-7/10y2u3v+7065xzu3v+5608yzu3v+4675z2u3v-73/90xu4v-15822yu4v-71/63zu4v+110/97u5v-69/5x3yv2+4315x2y2v2-124/45xy3v2-79/16y4v2-10739x3zv2-93/46x2yzv2+12499xy2zv2-73/86y3zv2+6367x2z2v2-12876xyz2v2-306y2z2v2-89xz3v2-70/51yz3v2+13120z4v2+61/57x3uv2+14782x2yuv2-91/9xy2uv2-2625y3uv2+14747x2zuv2-5899xyzuv2-12944y2zuv2-47/14xz2uv2-4551yz2uv2-99/101z3uv2-12618x2u2v2+1507xyu2v2-11951y2u2v2+68/49xzu2v2+49/39yzu2v2-56/103z2u2v2-31/85xu3v2-32/49yu3v2-65/14zu3v2+15/7u4v2+5749x3v3-3667x2yv3-107/29xy2v3+11301y3v3+95/18x2zv3-121/74xyzv3+75/26y2zv3+101/98xz2v3-111/76yz2v3-11335z3v3-15923x2uv3-36/83xyuv3-4134y2uv3-87/118xzuv3-41/11yzuv3+104/61z2uv3+12583xu2v3-50/23yu2v3-31/44zu2v3-29/23u3v3+108/107x2v4-8216xyv4-5009y2v4+101/26xzv4-9779yzv4+71/74z2v4-3358xuv4+83/84yuv4-34/39zuv4+44/47u2v4-112/83xv5+113/74yv5+82/79zv5-115/99uv5+12/109v6,-x4y-31/15x3y2+7231x2y3-99/37xy4-28/95x4z-53/107x3yz-4623x2y2z+5300xy3z-41/111y4z+12205x3z2+113/120x2yz2+54/49xy2z2-85/63y3z2+104/89x2z3-52/121xyz3-22/49y2z3+14367xz4+71/93yz4+55/56z5-5/81x4u-67/81x3yu-83/13x2y2u+98/55xy3u+15289y4u-94/111x3zu+40/29x2yzu-16/59xy2zu-107/14y3zu+2965x2z2u-459xyz2u-2/47y2z2u+35/22xz3u+119/39yz3u-12180z4u-13679x3u2+1534x2yu2+11305xy2u2-62/9y3u2-68/39x2zu2+11/90xyzu2-36/101y2zu2-2896xz2u2-15114yz2u2-49/114z3u2+19/16x2u3-11401xyu3-109/3y2u3+67/80xzu3+53/92yzu3+2894z2u3+119/74xu4+407yu4-65/53zu4+95/94u5-9309x4v+21/40x3yv+1436x2y2v+2194xy3v+6994y4v-116/81x3zv+13/2x2yzv-12/13xy2zv-23/84y3zv-61/83x2z2v+2023xyz2v+19/40y2z2v+43/26xz3v-59/113yz3v-47/53z4v+15580x3uv+21x2yuv+113/97xy2uv-15419y3uv-15243x2zuv+5128xyzuv-34/47y2zuv+13206xz2uv-4833yz2uv+107/91z3uv-1693x2u2v+54/53xyu2v-86/67y2u2v+98/9xzu2v+86/17yzu2v+64/89z2u2v+25/113xu3v+7884yu3v+14089zu3v-12027u4v-9471x3v2-36/85x2yv2-21/13xy2v2+15888y3v2+76/109x2zv2+4547xyzv2+115/12y2zv2-11/107xz2v2+6764yz2v2-8321z3v2+84/101x2uv2-202xyuv2+3251y2uv2+91/4xzuv2+7124yzuv2-53/81z2uv2+47/84xu2v2-8833yu2v2+117/14zu2v2-3/113u3v2+126/97x2v3-78/115xyv3+68/63y2v3-34/109xzv3+5913yzv3+6226z2v3-2365xuv3+91/120yuv3+14120zuv3-69/8u2v3+71/12xv4-13094yv4-7262zv4-33uv4+5367v5,-9533x4y-318x3y2+8/49x2y3+83/29xy4+13129y5+221x4z+115/48x3yz+12508x2y2z+97/52xy3z+11479y4z+8941x3z2+104/109x2yz2+9191xy2z2+103/64y3z2+10584x2z3-7728xyz3+3979y2z3+15/82xz4+5409yz4-1326z5+3756x4u-57/62x3yu+63/47x2y2u-14600xy3u+159y4u-11/4x3zu-113/57x2yzu-26/125xy2zu-32/87y3zu-10/21x2z2u+12927xyz2u-73/62y2z2u+115/99xz3u-13/3yz3u-126/25z4u-3969x3u2-122/57x2yu2-5003xy2u2-100/117y3u2-71/30x2zu2+7356xyzu2-2211y2zu2+31/40xz2u2-6722yz2u2-139z3u2+4426x2u3+1/115xyu3-72/85y2u3+15260xzu3+7938yzu3+4/115z2u3-33/89xu4+31/108yu4-50/83zu4+14/107u5+24/95x4v-113/17x3yv+81/14x2y2v-9957xy3v-10075y4v-122/113x3zv+65/118x2yzv-96/29xy2zv-19/41y3zv+113/35x2z2v+121/31xyz2v-9/68y2z2v+91/45xz3v-23/116yz3v-67/99z4v-5355x3uv-3112x2yuv-12824xy2uv-58/123y3uv-13/22x2zuv-19/85xyzuv-121/24y2zuv-14093xz2uv+99/95yz2uv+89/50z3uv+13096x2u2v-109/120xyu2v+121/61y2u2v+80/41xzu2v-39yzu2v-8/99z2u2v+5/17xu3v+112/69yu3v+14346zu3v-7173u4v+125/13x3v2+43/53x2yv2-78/103xy2v2-109/111y3v2+33/13x2zv2-15333xyzv2+87/49y2zv2-7212xz2v2+7729yz2v2-86/123z3v2-119/103x2uv2-71/122xyuv2-81/113y2uv2+6133xzuv2+55/72yzuv2+69/31z2uv2+12828xu2v2+94/15yu2v2-7588zu2v2+21/41u3v2-8712x2v3+74/9xyv3-11/87y2v3+1446xzv3-3/95yzv3-87/55z2v3-717xuv3-110/97yuv3-13/113zuv3-95/81u2v3-37/68xv4+5112yv4-56/11zv4-6/115uv4+7910v5,25/42x4y-42/79x3y2-59/21x2y3+2736xy4-107/115x4z-203x3yz+47/101x2y2z+7686xy3z-63/64y4z+103/57x3z2-12082x2yz2+11/102xy2z2-83/43y3z2+13/49x2z3-2685xyz3+123/44y2z3+31/12xz4+126/83yz4+14745z5+83/37x4u+7362x3yu-14615x2y2u-14109xy3u+49/47y4u+1929x3zu+83/71x2yzu-13640xy2zu-97/58y3zu-11141x2z2u-61/49xyz2u-3745y2z2u-74/21xz3u+3493yz3u-7540z4u-103/118x3u2-43/32x2yu2-9200xy2u2-23/65y3u2+15895x2zu2-13924xyzu2-14291y2zu2-11039xz2u2-31/37yz2u2-101/93z3u2-39/83x2u3-4536xyu3-78/47y2u3+75/44xzu3-24/121yzu3-81/113z2u3-81/89xu4+15825yu4-4111zu4+5850u5-12534x4v-69/94x3yv-10076x2y2v+3952xy3v+25/12y4v+21/34x3zv+11002x2yzv-54xy2zv+20/23y3zv+4991x2z2v+549xyz2v+2687y2z2v-110/9xz3v+11359yz3v+49/24z4v+62/107x3uv-27/41x2yuv-17/52xy2uv-10972y3uv+12/103x2zuv-318xyzuv-77/40y2zuv-114/53xz2uv+17/28yz2uv-8084z3uv+85/36x2u2v+7/100xyu2v-5772y2u2v-89/114xzu2v-40/121yzu2v+3340z2u2v+36/113xu3v-38/93yu3v+2519zu3v-7084u4v+8136x3v2-55/23x2yv2+27/7xy2v2+74/39y3v2+63/16x2zv2-8661xyzv2+2/91y2zv2+3773xz2v2-75/122yz2v2+447z3v2-59/109x2uv2-119/9xyuv2-67/49y2uv2-11334xzuv2-10482yzuv2-60/91z2uv2+94/65xu2v2-108/17yu2v2-69/70zu2v2-23/20u3v2+8/115x2v3+29/41xyv3+8/15y2v3-95/6xzv3-9714yzv3+2550z2v3-121/80xuv3+67/18yuv3+43/5zuv3+23/124u2v3-12509xv4-104/79yv4-73/21zv4-1238uv4+9038v5,94/107x4y+47/14x3y2-6362x2y3-20/59xy4-43/120y5-3028x4z-15141x3yz-2028x2y2z+84/115xy3z-3024y4z+2811x3z2+47/45x2yz2+121/101xy2z2-100/57y3z2+8/115x2z3+1/101xyz3-13/112y2z3+3618xz4+88/67yz4-52/63z5+102/97x4u-12/89x3yu-102x2y2u-3846xy3u-61/86y4u+85/54x3zu+78/29x2yzu-13381xy2zu-49/95y3zu-77/2x2z2u-5784xyz2u+1557y2z2u-9163xz3u-114/121yz3u-57/103z4u+36/31x3u2-9062x2yu2-23/111xy2u2+7362y3u2-7671x2zu2+14945xyzu2+7901y2zu2+51/5xz2u2-109/48yz2u2+7696z3u2+11280x2u3-44/57xyu3-13736y2u3-13458xzu3-14723yzu3-707z2u3+899xu4-10381yu4+99/25zu4-7788u5-237x4v+45/43x3yv-7666x2y2v-4/109xy3v+4303y4v-13107x3zv-108/91x2yzv-7707xy2zv-73/47y3zv+61/118x2z2v-11/65xyz2v+2970y2z2v-104/37xz3v-15408yz3v-64/55z4v+47/113x3uv+2185x2yuv+7941xy2uv-61/37y3uv+6482x2zuv-11/70xyzuv+83/110y2zuv-109/83xz2uv-86/95yz2uv-7583z3uv+83/45x2u2v+89/38xyu2v-2/11y2u2v+3577xzu2v+124/125yzu2v-1151z2u2v+109/85xu3v+70/13yu3v+37/104zu3v-210u4v+51/29x3v2-104/111x2yv2+105/58xy2v2-13459y3v2-80/79x2zv2-3006xyzv2-115/16y2zv2+8208xz2v2+35/38yz2v2+49/27z3v2-1647x2uv2+10482xyuv2-34/93y2uv2+97/18xzuv2+101/20yzuv2+1711z2uv2+91/36xu2v2-96/23yu2v2+7006zu2v2+86/31u3v2-10734x2v3-43/18xyv3-4597y2v3-11174xzv3-7334yzv3+7/96z2v3+4/97xuv3-5/82yuv3-15600zuv3-69/94u2v3-71/25xv4+21/97yv4+117/23zv4-6557uv4-67/83v5,8164x4y+19/73x3y2-1592x2y3-28/87xy4-63/103x4z+11/42x3yz-52/67x2y2z-13766xy3z+11378y4z+10/37x3z2+115/41x2yz2+11/100xy2z2-49/40y3z2+86/111x2z3+124/5xyz3-25/79y2z3-14525xz4+11380yz4-53/42z5-12169x4u-14/51x3yu+68/33x2y2u-3/62xy3u-31/22y4u-74/93x3zu+12924x2yzu-103/123xy2zu-74/97y3zu-2789x2z2u-95/32xyz2u+45/13y2z2u+40/71xz3u+49/110yz3u+34/75z4u+9829x3u2-59/92x2yu2+106/65xy2u2+123/86y3u2+7133x2zu2-73/46xyzu2-7/29y2zu2-937xz2u2-65/67yz2u2-88/111z3u2-61/119x2u3+975xyu3-54/7y2u3-37/33xzu3+61/59yzu3+51/115z2u3+117/43xu4+8506yu4+13941zu4-14945u5-115/63x4v-14237x3yv-74/87x2y2v+104/47xy3v-95/104y4v+11535x3zv-119/75x2yzv-44xy2zv+11299y3zv-21/113x2z2v-2852xyz2v+95/77y2z2v-75/19xz3v-4864yz3v-79/88z4v+139x3uv-10068x2yuv+2049xy2uv+7515y3uv+97/56x2zuv+109/113xyzuv+7778y2zuv-71/11xz2uv-80/19yz2uv+55/59z3uv-69/98x2u2v-15679xyu2v+114/11y2u2v+69/65xzu2v+879yzu2v+45/104z2u2v+47/97xu3v-1373yu3v+15885zu3v+11121u4v-5042x3v2+4/25x2yv2-8607xy2v2-25/33y3v2+93/55x2zv2+68xyzv2-4167y2zv2+14180xz2v2-115/47yz2v2-81/67z3v2-12099x2uv2+34/107xyuv2+122/59y2uv2+775xzuv2-91yzuv2-85/96z2uv2-59/95xu2v2+174yu2v2+11/16zu2v2+66/37u3v2-121/36x2v3+6070xyv3-83/52y2v3-121/59xzv3-55/12yzv3+8088z2v3-20/29xuv3+76/125yuv3-10858zuv3+1833u2v3-103/50xv4+76/93yv4-119/18zv4+37/114uv4+51/7v5,85/56x4y-7839x3y2+12/37x2y3+6558xy4-8191x4z+115/7x3yz+81/23x2y2z-4121xy3z-1131y4z-23/37x3z2-71/32x2yz2+30/97xy2z2+5070y3z2-49/123x2z3+103/88xyz3-45/19y2z3+5132xz4+7277yz4+1896z5-103/75x4u-12020x3yu+12337x2y2u+6248xy3u+14290y4u-87/44x3zu-5364x2yzu-11801xy2zu-59/37y3zu+34/109x2z2u-14482xyz2u-10338y2z2u+118/73xz3u+7/8yz3u+158z4u+10590x3u2-5182x2yu2+83/62xy2u2+11557y3u2-92/119x2zu2-37/94xyzu2+5383y2zu2-365xz2u2+7/62yz2u2-7965z3u2-10/43x2u3+119/101xyu3-113/83y2u3-121/41xzu3+61/104yzu3+37/60z2u3-74/95xu4-113/66yu4-205zu4+4787u5-94/93x4v+14871x3yv-14723x2y2v+10730xy3v+112/17y4v-35/19x3zv-3487x2yzv-65/43xy2zv-7445y3zv-79/124x2z2v+7423xyz2v+91/2y2z2v+91/34xz3v-6970yz3v-50/113z4v+75/43x3uv-127x2yuv+11978xy2uv+48/113y3uv+113/62x2zuv-8941xyzuv-101/112y2zuv-5737xz2uv-31/123yz2uv+9490z3uv+19/92x2u2v-107/73xyu2v-23/121y2u2v+38/65xzu2v-672yzu2v+13/77z2u2v+46/119xu3v-103/18yu3v+107/59zu3v-52/21u4v-94/87x3v2-74/31x2yv2-9/22xy2v2-2896y3v2+113/3x2zv2-5386xyzv2-11391y2zv2+42/97xz2v2+77/64yz2v2-1610z3v2-102/43x2uv2+124/39xyuv2+14829y2uv2+88/113xzuv2-10411yzuv2-51/43z2uv2-36/121xu2v2+9487yu2v2-5589zu2v2+4335u3v2-5/91x2v3+6084xyv3-56/39y2v3-84/101xzv3-81/85yzv3-6521z2v3-2432xuv3+14317yuv3-43/82zuv3+121/8u2v3+14783xv4-92/45yv4+112/27zv4-8410uv4+31/105v5,-6691x4y-10158x3y2-5372x2y3+4132xy4+106/9y5+15600x4z-803x3yz+43/29x2y2z+9/91xy3z-92/61y4z+4807x3z2-12562x2yz2+14234xy2z2-91/17y3z2-91/30x2z3-10615xyz3-4206y2z3-29/45xz4-11/86yz4-115/9z5+125/112x4u+52/59x3yu+92/49x2y2u+121/85xy3u-51/14y4u-73/48x3zu-1/110x2yzu+12/65xy2zu+15045y3zu+12826x2z2u-123/89xyz2u+9465y2z2u-67/31xz3u-5080yz3u-7944z4u-107/72x3u2+1473x2yu2+7965xy2u2+15753y3u2-95/98x2zu2-9827xyzu2-25/53y2zu2-83/54xz2u2-13217yz2u2-117/110z3u2+230x2u3-12120xyu3+11/36y2u3-2071xzu3+109/59yzu3+6909z2u3-15/64xu4+45/82yu4-3091zu4-15711u5+5957x4v-45/86x3yv+26/29x2y2v-40/57xy3v+25/43y4v+126/37x3zv-38/33x2yzv+65/109xy2zv-33/68y3zv-7287x2z2v-4842xyz2v+35/118y2z2v+6157xz3v-97/89yz3v-91/50z4v-70/27x3uv+32/9x2yuv+78/125xy2uv+38/7y3uv-3214x2zuv-68/101xyzuv+87/55y2zuv-69/98xz2uv+5805yz2uv+41/102z3uv-43/54x2u2v-42/73xyu2v-13/49y2u2v+11864xzu2v+121/37yzu2v-100/109z2u2v-12609xu3v-9114yu3v-8746zu3v+11659u4v+3799x3v2-9581x2yv2+60/91xy2v2+2029y3v2+12075x2zv2+210xyzv2-1/22y2zv2+17/58xz2v2+1212yz2v2+118/27z3v2-3571x2uv2-3139xyuv2-23/100y2uv2-1240xzuv2+71/49yzuv2-21/103z2uv2-110/71xu2v2-40/77yu2v2-103/29zu2v2+10737u3v2+2828x2v3+14/39xyv3+7564y2v3+113/50xzv3+38/79yzv3+59/66z2v3+2726xuv3+91/94yuv3-15730zuv3-13408u2v3-97/42xv4+54/29yv4-33/73zv4+4823uv4+57/71v5,-14556x3yz-9751x2y2z-45/28xy3z+85/23y4z+5623x3z2+5369x2yz2-19/60xy2z2-36/5y3z2-95/36x2z3+5862xyz3-5/93y2z3+2949xz4+11357yz4-5679z5-52/45x3yu+4448x2y2u-9/22xy3u+2427y4u+3296x3zu+16/39x2yzu+53/57xy2zu+15/41y3zu+9473x2z2u+37xyz2u-58/69y2z2u-23/56xz3u-13/90yz3u-54/29z4u-41/67x3u2+10258x2yu2+23/44xy2u2-12952y3u2+2124x2zu2-1677xyzu2+12911y2zu2+22/45xz2u2+17/84yz2u2+5910z3u2+4782x2u3+119/39xyu3-17/84y2u3-120/91xzu3+35/59yzu3+17/77z2u3-4467xu4-77/4yu4-26/53zu4-3580u5-11977x3yv-118/77x2y2v+6040xy3v+9724y4v-47/5x3zv+59/101x2yzv+1212xy2zv-7/121y3zv+93/53x2z2v-56/23xyz2v-4470y2z2v+110/111xz3v-41/99yz3v-81/10z4v-71/24x3uv+26/115x2yuv+59/39xy2uv-10029y3uv+11748x2zuv+5749xyzuv+6887y2zuv+38/3xz2uv-116/61yz2uv-55/118z3uv+105/22x2u2v+70/87xyu2v-28/13y2u2v-109/123xzu2v-102/47yzu2v-52/71z2u2v+101/95xu3v+51/16yu3v+15/97zu3v-78/125u4v+35/46x3v2-9526x2yv2+10781xy2v2-119/44y3v2-23/10x2zv2+59/29xyzv2-15144y2zv2+29/120xz2v2-53/126yz2v2-93/85z3v2+53/8x2uv2-487xyuv2-12143y2uv2+13825xzuv2+55/6yzuv2-4250z2uv2+4237xu2v2-109/9yu2v2+67/53zu2v2+82/33u3v2+8660x2v3+15046xyv3-79/84y2v3-10310xzv3+110yzv3-7636z2v3+57/92xuv3-22/119yuv3-95/103zuv3+5138u2v3+123/49xv4-7587yv4+30/41zv4-124/121uv4+54/71v5,-29/60x4y-108/77x3y2-109/37x2y3-3619xy4+109/6x4z-37/67x3yz+53/45x2y2z+5291xy3z-2927y4z+34/5x3z2+87/17x2yz2+100/89xy2z2-114/29y3z2-4057x2z3-1/42xyz3-14/61y2z3-398xz4-122/73yz4+66/37z5+99/37x4u-5691x3yu-8778x2y2u+17/115xy3u+51/113y4u-71/101x3zu+85/91x2yzu-92/9xy2zu-3442y3zu+109/26x2z2u+50/37xyz2u+77/94y2z2u+16/35xz3u+9985yz3u+5/102z4u-5932x3u2+89/125x2yu2-895xy2u2-12455y3u2-630x2zu2-64/47xyzu2+25/9y2zu2+7906xz2u2+6827yz2u2+9808z3u2-113/118x2u3+79/8xyu3+9484y2u3+62/39xzu3+6/85yzu3-23/49z2u3-93/115xu4-11/93yu4-15177zu4-13/2u5-7623x4v-103/73x3yv-96/115x2y2v+39/76xy3v+80/79y4v+43/68x3zv+45/97x2yzv+101/87xy2zv+4632y3zv-918x2z2v+8248xyz2v-4276y2z2v+8853xz3v-39/61yz3v-121/87z4v+9968x3uv+473x2yuv+117/56xy2uv-19/21y3uv+121/119x2zuv+3/98xyzuv-65/42y2zuv-3723xz2uv+7/34yz2uv-112/87z3uv+103x2u2v+25/41xyu2v-14459y2u2v-56/41xzu2v-59/81yzu2v-109/102z2u2v-87/16xu3v-13011yu3v+49/123zu3v+106/89u4v-61/51x3v2+14107x2yv2+8035xy2v2-8853y3v2+5723x2zv2+123/53xyzv2-9727y2zv2-102/83xz2v2+1111yz2v2-15745z3v2+83/118x2uv2-57/35xyuv2-48/73y2uv2-28/37xzuv2-27/97yzuv2-27/58z2uv2+71/93xu2v2+117/8yu2v2+12344zu2v2-2497u3v2-118/71x2v3-11/19xyv3+21/104y2v3+32/113xzv3+15544yzv3+31/18z2v3+5909xuv3-67/58yuv3+27/35zuv3+115/9u2v3+79/13xv4+6722yv4-37/114zv4-71/124uv4+4657v5,-77/61x4y-88/101x3y2+93/88x2y3-11/70xy4+9806y5+7896x4z-4699x3yz+55/122x2y2z-63/122xy3z-125/74y4z+47/45x3z2+101/17x2yz2+92/47xy2z2+69/82y3z2+12402x2z3+113/98xyz3-101/33y2z3-15376xz4+47/71yz4-73/10z5+65/74x4u-14409x3yu-14478x2y2u+13593xy3u+102/97y4u+39/62x3zu-34/125x2yzu-83/9xy2zu+45/113y3zu+14484x2z2u-15293xyz2u-26/55y2z2u-958xz3u+67/35yz3u-93/19z4u+25/16x3u2+107/52x2yu2-4599xy2u2-86/51y3u2-9885x2zu2-77/47xyzu2+33/65y2zu2+90/109xz2u2-61/26yz2u2+6198z3u2-38/37x2u3-13935xyu3-142y2u3-64/5xzu3-7228yzu3+1251z2u3+1556xu4+117/121yu4-92/35zu4+99/92u5+13493x4v+12654x3yv+32/101x2y2v-11118xy3v+43/51y4v-575x3zv+103/21x2yzv+85/24xy2zv+1788y3zv+85/3x2z2v-64/25xyz2v+57/35y2z2v+37/120xz3v-69/110yz3v+48/49z4v+55/114x3uv-6439x2yuv+31/51xy2uv-90/49y3uv-45/104x2zuv-12018xyzuv+6/119y2zuv+40/63xz2uv+20/91yz2uv+50/43z3uv+1/26x2u2v-109/47xyu2v+99/7y2u2v+72/83xzu2v+61/118yzu2v+3530z2u2v+6146xu3v+117yu3v-9921zu3v-8708u4v-10/47x3v2-15294x2yv2-7336xy2v2+1/66y3v2-3057x2zv2+74/123xyzv2+146y2zv2-103/34xz2v2-117/76yz2v2+8472z3v2-7/92x2uv2+10033xyuv2+43/53y2uv2+4694xzuv2-49/2yzuv2-71/73z2uv2-125/17xu2v2-9817yu2v2+7218zu2v2+6897u3v2-19/90x2v3+11899xyv3-11779y2v3-5456xzv3+17/42yzv3+15340z2v3+12/7xuv3+9580yuv3-502zuv3-14069u2v3-4371xv4+14452yv4-9423zv4-117/122uv4+1126v5,49/108x4-39/4x3y-67/21x2y2-8/69xy3-9779y4+57/14x3z-11145x2yz+6928xy2z-7824y3z+1/79x2z2+5173xyz2-62/15y2z2-123/112xz3+88/79yz3+1/125z4+57/23x3u-11856x2yu-7444xy2u+115/8y3u-11133x2zu+71/73xyzu-7941y2zu+69/65xz2u+22/75yz2u+65/121z3u+9471x2u2+9167xyu2+51/59y2u2+12835xzu2+15047yzu2+11102z2u2-10059xu3+19/28yu3+65/21zu3-39/28u4-3/73x3v+94/61x2yv+8778xy2v-12922y3v-8711x2zv-37/97xyzv+14270y2zv+4487xz2v-59/112yz2v-14183z3v+15553x2uv+3579xyuv+114/91y2uv-4/97xzuv+13/85yzuv-89/15z2uv+58/75xu2v-34/7yu2v-90/61zu2v+90/101u3v-14673x2v2+90/19xyv2-45/37y2v2+23/49xzv2-71/11yzv2+119/8z2v2+89/10xuv2+109/91yuv2+36/49zuv2-7/31u2v2-40/113xv3-21/121yv3+9910zv3+33/14uv3-23/79v4,93/70x4-43/125x3y+9582x2y2+7565xy3-11511y4-3/79x3z-36/107x2yz-2038xy2z+879y3z-4700x2z2+103/14xyz2+102/79y2z2-67/68xz3-44/25yz3+105/79z4-29/24x3u-74/83x2yu+67/43xy2u+49/12y3u-115/11x2zu+23/67xyzu-61/27y2zu+12257xz2u+14068yz2u+23/15z3u+607x2u2+73/8xyu2+14237y2u2-13/33xzu2+110/71yzu2+41/101z2u2+5708xu3+88/67yu3+1460zu3-2472u4-1629x3v-51/70x2yv-88/73xy2v-36/97y3v+38/11x2zv+15899xyzv+54/19y2zv+9460xz2v-5150yz2v+3462z3v+5522x2uv-19/123xyuv+14871y2uv+53/5xzuv-7535yzuv-13430z2uv+107/47xu2v-8307yu2v-55/79zu2v-11945u3v-16/83x2v2+115/48xyv2+12389y2v2+11545xzv2-25/26yzv2-3755z2v2+4724xuv2-31/21yuv2+7872zuv2+89/45u2v2+87/47xv3+7625yv3+13494zv3-15376uv3-25/126v4;TestGRRes(Name, I); kill R, Name, @p; "";

  string Name = "rat.d10.g9.quart2"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;ideal I = x3yu2-48/11x2y2u2-8356xy3u2+35/121y4u2+31/66x3zu2-54/83x2yzu2-61/18xy2zu2+11526y3zu2+7372x2z2u2-91/60xyz2u2-95/97y2z2u2-45/71xz3u2+71/115yz3u2+25/54z4u2-61/102x3u3-12668x2yu3+6653xy2u3+41/54y3u3+87/50x2zu3-5004xyzu3+13924y2zu3+2310xz2u3-93/14yz2u3-2/93z3u3-97/125x2u4-58/11xyu4+46/73y2u4-4417xzu4+60/101yzu4+56/75z2u4-113/118xu5+115/4yu5-40zu5-8554u6-54/83x3yuv-9770x2y2uv-590xy3uv+15/49y4uv+94/69x3zuv+121/105x2yzuv+95/88xy2zuv+3186y3zuv+11/6x2z2uv-44/81xyz2uv+637y2z2uv+109/121xz3uv-33yz3uv-94/115z4uv-49/95x3u2v-11/109x2yu2v+45/113xy2u2v+97/84y3u2v+5257x2zu2v+99/49xyzu2v+12584y2zu2v-4294xz2u2v+1137yz2u2v-58/69z3u2v-4749x2u3v+120/97xyu3v-31/103y2u3v+62/97xzu3v-107/74yzu3v+53/59z2u3v+91/33xu4v+1291yu4v+23/34zu4v+58/77u5v+16/17x3yv2-750x2y2v2+86/89xy3v2+123/46y4v2+53/123x3zv2-61/99x2yzv2+12389xy2zv2+10419y3zv2+43/11x2z2v2-146xyz2v2-116/51y2z2v2+13/62xz3v2-5524yz3v2-111/118z4v2-56/55x3uv2-3038x2yuv2+14/27xy2uv2-43/64y3uv2+3385x2zuv2+25/11xyzuv2+92/41y2zuv2+28/113xz2uv2-2049yz2uv2+89/37z3uv2-13094x2u2v2-2774xyu2v2+15474y2u2v2-15791xzu2v2-71/116yzu2v2+77/41z2u2v2-83/68xu3v2-33/106yu3v2+71/37zu3v2-41/17u4v2+12052x3v3+1906x2yv3+13825xy2v3+80/7y3v3-125/96x2zv3-9661xyzv3+85/116y2zv3-72/91xz2v3+13/112yz2v3-126/97z3v3-1637x2uv3+34/103xyuv3+3844y2uv3+77/10xzuv3+6359yzuv3-11185z2uv3-124/121xu2v3+66/91yu2v3-14636zu2v3-1051u3v3+9/64x2v4-12924xyv4-119/41y2v4+74/23xzv4+1622yzv4+73/37z2v4-60/101xuv4+111/22yuv4-45/124zuv4+59/37u2v4-66/37xv5-71/99yv5+12409zv5-113/64uv5-5267v6,-x4y-22/79x3y2-125/42x2y3-116/7xy4+98/111y5-31/66x4z-118/75x3yz+110/93x2y2z-43/92xy3z-788y4z-7372x3z2-2701x2yz2-67/124xy2z2-117/62y3z2+45/71x2z3-8396xyz3-10343y2z3-25/54xz4+30/59yz4+61/102x4u+11736x3yu+12726x2y2u+41/118xy3u-15832y4u-87/50x3zu-130x2yzu+41/8xy2zu-10300y3zu-2310x2z2u-101/5xyz2u+6205y2z2u+2/93xz3u+8679yz3u+97/125x3u2-43/37x2yu2-39/80xy2u2+12139y3u2+4417x2zu2+4294xyzu2+11/58y2zu2-56/75xz2u2+8338yz2u2+113/118x2u3-10190xyu3-37/16y2u3+40xzu3+74/23yzu3+8554xu4+115/22yu4-39/79x4v+61/72x3yv+8048x2y2v-9201xy3v+16/121y4v+113/93x3zv+109/75x2yzv+12700xy2zv-10607y3zv+50/11x2z2v+1223xyz2v-103/79y2z2v-123/58xz3v+31/26yz3v-15/122z4v+122/25x3uv-99/17x2yuv+1723xy2uv-38/121y3uv+11016x2zuv-25/102xyzuv-14970y2zuv-61/6xz2uv-14981yz2uv+15900z3uv+3268x2u2v-75/19xyu2v-1436y2u2v-1764xzu2v-57/41yzu2v+12741z2u2v-14615xu3v+119/61yu3v-115/119zu3v+10501u4v-8502x3v2-51/76x2yv2-6281xy2v2+17/49y3v2-106/7x2zv2+63/101xyzv2-27/95y2zv2-1606xz2v2+9245yz2v2+1912z3v2+11155x2uv2+223xyuv2-13/18y2uv2+110/43xzuv2+76/81yzuv2-6291z2uv2+1400xu2v2-95/23yu2v2-9701zu2v2+106/105u3v2+72/47x2v3-13118xyv3+14409y2v3+37/86xzv3+44/69yzv3-325z2v3+113/71xuv3+16/81yuv3+6/19zuv3-119/39u2v3-89/9xv4+72/53yv4+112/55zv4-8587uv4-6604v5,-x3y2+48/11x2y3+8356xy4-35/121y5-12750x3yz+100/111x2y2z+45/74xy3z+99/74y4z-6/7x3z2-47/67x2yz2+11465xy2z2-11865y3z2+7776x2z3+124/45xyz3-98/115y2z3+117/85xz4-59/120yz4-8748z5+61/102x3yu+12668x2y2u-6653xy3u-41/54y4u+13408x3zu-2185x2yzu-1240xy2zu+1161y3zu+44/27x2z2u-11164xyz2u-13388y2z2u-107/13xz3u+90/71yz3u+4204z4u+97/125x2yu2+58/11xy2u2-46/73y3u2+55/48x2zu2+121/31xyzu2+126/61y2zu2-55/69xz2u2+5988yz2u2+3755z3u2+113/118xyu3-115/4y2u3+3390xzu3-5762yzu3+30/61z2u3+8554yu4-14317zu4+99/116x3yv-113/119x2y2v+50/23xy3v-37/79y4v-8668x3zv+14049x2yzv+111/35xy2zv+61/28y3zv-10171x2z2v+68/21xyz2v+2023y2z2v-9/109xz3v+8520yz3v-2683z4v-13547x3uv+28/65x2yuv-5988xy2uv+61/111y3uv+12314x2zuv+29/44xyzuv+6141y2zuv+11280xz2uv+79/22yz2uv-38/111z3uv+19/51x2u2v+5093xyu2v-10291y2u2v-5009xzu2v-111/49yzu2v+3813z2u2v-61/37xu3v+15914yu3v-3218zu3v-12915u4v-118/101x3v2-7/57x2yv2+13128xy2v2+11606y3v2+42/101x2zv2-54/17xyzv2-43/49y2zv2-119/110xz2v2+9742yz2v2-43/4z3v2-55/8x2uv2-29/88xyuv2+12042y2uv2+101/37xzuv2-57/62yzuv2+106/97z2uv2+38/83xu2v2+8152yu2v2-5492zu2v2-47/79u3v2+15112x2v3+69/44xyv3-6/71y2v3+113/54xzv3-13210yzv3-707z2v3-119/8xuv3+3845yuv3-19/20zuv3+4852u2v3+15761xv4-12372yv4+74/69zv4-2100uv4-12833v5,-x3yz+48/11x2y2z+8356xy3z-35/121y4z-31/66x3z2+54/83x2yz2+61/18xy2z2-11526y3z2-7372x2z3+91/60xyz3+95/97y2z3+45/71xz4-71/115yz4-25/54z5+15/52x3yu+6039x2y2u+74/99xy3u-17/40y4u+29/50x3zu-7775x2yzu+6368xy2zu+14170y3zu+52/41x2z2u+7003xyz2u-5787y2z2u-101/37xz3u-23/28yz3u-20/63z4u+41/77x3u2+8650x2yu2-15922xy2u2-16/83y3u2+7278x2zu2+31/30xyzu2-2/107y2zu2+35/122xz2u2+85/58yz2u2-757z3u2+2/101x2u3+86/17xyu3+95/59y2u3+123/22xzu3-6869yzu3-9311z2u3-105/97xu4+5699yu4+15925zu4+13528u5-154x3yv+4187x2y2v+56/107xy3v-15932y4v-5137x3zv-37/56x2yzv+9401xy2zv+92/123y3zv-79/97x2z2v+9201xyz2v+19/53y2z2v+107/20xz3v+17/77yz3v-15306z4v+3215x3uv-79/117x2yuv-9/76xy2uv-6352y3uv+93/13x2zuv-65/89xyzuv-115/4y2zuv-34/57xz2uv+39/107yz2uv+31/9z3uv+107/48x2u2v+2632xyu2v+29/96y2u2v-125/89xzu2v+29/113yzu2v+3940z2u2v-116/111xu3v+6145yu3v-105/62zu3v+101/17u4v-9281x3v2-49/107x2yv2-12154xy2v2+4/19y3v2-114/71x2zv2-15/118xyzv2+4372y2zv2+45/121xz2v2+46/111yz2v2+6614z3v2+17x2uv2+10806xyuv2-10617y2uv2-25/111xzuv2-116/27yzuv2-7/58z2uv2-686xu2v2+3/13yu2v2-17/49zu2v2-40/107u3v2+47/90x2v3-83/43xyv3-6326y2v3+49/64xzv3+113/76yzv3-122/73z2v3+10232xuv3-116/109yuv3-1990zuv3+70/51u2v3-118/19xv4-27/55yv4+21/19zv4-23/57uv4-11721v5,-3399x4y+1849x3y2-3/29x2y3+28/87xy4+10/29y5-9788x4z-49/73x3yz+13829x2y2z+118/73xy3z+13129y4z-618x3z2+92/13x2yz2+101/117xy2z2-162y3z2+24/5x2z3-29/74xyz3+2687y2z3-74/39xz4+2/57yz4+68/73x4u-13787x3yu-11659x2y2u+14729xy3u+92/53y4u+15/71x3zu-62/15x2yzu+21/85xy2zu+4938y3zu-120/37x2z2u-77/102xyz2u-4785y2z2u-83/70xz3u-12128yz3u-13592z4u-123/20x3u2+2607x2yu2+40/19xy2u2+6361y3u2-3091x2zu2+89/113xyzu2+149y2zu2-2890xz2u2-8374yz2u2+11886z3u2-49/43x2u3-9854xyu3-6943y2u3+10743xzu3-122/45yzu3-13902z2u3-103/19xu4-48/59yu4+27/86zu4+46/35u5-117/17x4v-15/7x3yv+8409x2y2v-83/28xy3v+86/35y4v+37/45x3zv+4/3x2yzv+35/38xy2zv+4015y3zv-49/111x2z2v-1260xyz2v-25/33y2z2v+116/19xz3v+93/8yz3v+5755z4v-25/89x3uv-11669x2yuv-64/107xy2uv+2993y3uv+7767x2zuv-17/95xyzuv-103/80y2zuv-14576xz2uv+80/47yz2uv+25/107z3uv+103/2x2u2v+125/117xyu2v-2/89y2u2v-5298xzu2v-50/27yzu2v-71/53z2u2v+2652xu3v+15761yu3v+2124zu3v+11/82u4v+100/63x3v2+4180x2yv2+11/39xy2v2-1221y3v2+108/125x2zv2+97/126xyzv2-7698y2zv2+13984xz2v2+1342yz2v2-84/121z3v2-26/73x2uv2-14/15xyuv2-22/37y2uv2-71/82xzuv2+12430yzuv2+103/52z2uv2-13095xu2v2+10114yu2v2-8/73zu2v2-33/97u3v2+83/105x2v3+22/45xyv3-7961y2v3-9654xzv3-54/55yzv3-3/71z2v3-10148xuv3-117/98yuv3+101/102zuv3-606u2v3+97/43xv4-68/21yv4+63/16zv4+42/17uv4+5834v5,-3399x3y2-32/113x2y3+14/99xy4+15001y5-121/115x3yz+4604x2y2z+7/2xy3z+9532y4z-3267x3z2+97/118x2yz2-14238xy2z2-80/21y3z2-12332x2z3-19/69xyz3+116/15y2z3-103/32xz4+15340yz4+10509z5+112/109x3yu-97x2y2u-40/11xy3u+90/29y4u-95/106x3zu-114/67x2yzu+113/48xy2zu+12080y3zu-44x2z2u+18/17xyz2u-4814y2z2u-103/100xz3u-96/61yz3u-205z4u-87/82x3u2-97/108x2yu2+3230xy2u2+104/83y3u2+41/86x2zu2+116/49xyzu2-59/110y2zu2+14/59xz2u2-6962yz2u2-2185z3u2+59/91x2u3+2497xyu3+3/37y2u3-13010xzu3+6/83yzu3-11448z2u3+13/72xu4-69/62yu4-2869zu4+23/73u5-20/43x3yv+5074x2y2v+28/125xy3v-2706y4v+13010x3zv-17/109x2yzv+21/4xy2zv+59/93y3zv-2406x2z2v+117/11xyz2v-14978y2z2v+70/89xz3v-33/7yz3v-13676z4v-13690x3uv+9825x2yuv-117/107xy2uv+12760y3uv-93/98x2zuv-113/64xyzuv+113/103y2zuv-9748xz2uv+11016yz2uv-10729z3uv+90/13x2u2v-13/47xyu2v-11/39y2u2v+20/69xzu2v+5531yzu2v+125/49z2u2v-11025xu3v-9621yu3v+113/109zu3v+4710u4v-107/7x3v2+110/119x2yv2-10025xy2v2-6644y3v2-5041x2zv2+5/96xyzv2+11472y2zv2-5128xz2v2+2927yz2v2+121/18z3v2-125/89x2uv2+12936xyuv2-71/47y2uv2+34/47xzuv2-75/103yzuv2-2654z2uv2-2350xu2v2-7707yu2v2+47/72zu2v2-952u3v2-21/67x2v3+58/37xyv3-8757y2v3+3615xzv3+44/123yzv3-13027z2v3-9/10xuv3+75/43yuv3+115/18zuv3+8071u2v3-26/3xv4-67/65yv4+14186zv4-41/122uv4+33/28v5,-3399x3yz-32/113x2y2z+14/99xy3z+15001y4z-9788x3z2+37/96x2yz2+7743xy2z2+31/55y3z2-618x2z3-8171xyz3+82/109y2z3+24/5xz4+88/85yz4-74/39z5-13165x3yu+3407x2y2u-12509xy3u-23/45y4u-11774x3zu-10/67x2yzu+69/79xy2zu-10/123y3zu-7636x2z2u+83/32xyz2u+51/112y2z2u+19/8xz3u+9309yz3u-44/49z4u+4089x3u2-374x2yu2-919xy2u2+98/107y3u2+2776x2zu2+85/26xyzu2+31/13y2zu2-103/82xz2u2+35/76yz2u2+59/45z3u2+2950x2u3+27/44xyu3+88/71y2u3+7/114xzu3-72/77yzu3+12917z2u3-34/67xu4-85/82yu4-55/84zu4+4690u5+11/42x3yv-19/125x2y2v-8288xy3v+9199y4v-12929x3zv+13357x2yzv-4903xy2zv-584y3zv-10/33x2z2v+59/113xyz2v+103/92y2z2v+101/69xz3v+8708yz3v-8/7z4v+13560x3uv-43/49x2yuv-121/98xy2uv+75/79y3uv-39x2zuv-88/69xyzuv-89/78y2zuv+110/67xz2uv+61/4yz2uv-98/45z3uv+82/7x2u2v-85/41xyu2v+6548y2u2v+9367xzu2v-59/81yzu2v-14408z2u2v+2363xu3v-80/11yu3v-50/17zu3v-14799u4v-53/21x3v2+9437x2yv2-117/80xy2v2+81/85y3v2-8/45x2zv2-6428xyzv2+15126y2zv2+68/89xz2v2+7/122yz2v2+9639z3v2+113/4x2uv2-8678xyuv2-104/45y2uv2-79/90xzuv2+39/101yzuv2-7234z2uv2-28/43xu2v2+1251yu2v2-97/56zu2v2+17/41u3v2+107/24x2v3+2747xyv3+9933y2v3-4199xzv3+53/83yzv3+6364z2v3-5456xuv3+618yuv3-123/55zuv3+2375u2v3+63/76xv4-115/106yv4-8811zv4-31/75uv4+10/109v5,13/89x4y+77/31x3y2+36/83x2y3-11411xy4+6936y5-12223x4z+7400x3yz+33/118x2y2z-12146xy3z+108/79y4z+82/99x3z2-9877x2yz2-79/70xy2z2-19/123y3z2-1491x2z3+7953xyz3-43/126y2z3+60/17xz4+98/57yz4-13317x4u-77/27x3yu-6811x2y2u-69/61xy3u+6144y4u+5404x3zu+121/120x2yzu-91/23xy2zu-71/106y3zu+1435x2z2u-120/13xyz2u-12019y2z2u-68/7xz3u-113/82yz3u+11526z4u-8706x3u2-89/53x2yu2-14804xy2u2+120/107y3u2+71/94x2zu2-1/70xyzu2+1532y2zu2+4470xz2u2+13/60yz2u2-115/102z3u2-82/21x2u3+27/121xyu3-4439y2u3-101/47xzu3-3186yzu3-106/101z2u3-10169xu4+19/58yu4-96/73zu4-7959u5-10526x4v-107/92x3yv+47/6x2y2v-23/43xy3v-69/62y4v+59/65x3zv-28/95x2yzv+5479xy2zv-39/77y3zv+11/69x2z2v-11713xyz2v+43/79y2z2v-15602xz3v+16/73yz3v-13952z4v+61/82x3uv-2219x2yuv-91/106xy2uv+5/37y3uv-148x2zuv+31/51xyzuv+18/101y2zuv+97/68xz2uv-73/32yz2uv+47/2z3uv+2/41x2u2v-13009xyu2v-7/60y2u2v+15779xzu2v+72/7yzu2v-11/73z2u2v-119/44xu3v-9067yu3v+3249zu3v+61/51u4v+12525x3v2-118/9x2yv2-3270xy2v2-4/25y3v2-5075x2zv2+77/40xyzv2-89/65y2zv2+17/58xz2v2-15609yz2v2+95/54z3v2-75/79x2uv2-4907xyuv2+12418y2uv2-57/17xzuv2-8746yzuv2+13/95z2uv2-124/67xu2v2+16/13yu2v2+28/23zu2v2-10847u3v2-645x2v3+106/75xyv3+6/115y2v3-8495xzv3+58/35yzv3-9398z2v3-101/72xuv3-71/20yuv3-124/65zuv3-8971u2v3+27/28xv4+12/29yv4-4276zv4+10858uv4+29/12v5,13/89x3y2+12068x2y3-15543xy4-77/79y5+6626x3yz+64/53x2y2z-6/23xy3z-47/125y4z+14403x3z2-43/78x2yz2-31/115xy2z2+94/59y3z2-118/117x2z3-11229xyz3+2268y2z3-116/85xz4+25/58yz4+3085z5+59/27x3yu+67/82x2y2u+11/6xy3u+103/47y4u-63/80x3zu-81/47x2yzu+7760xy2zu-115/56y3zu-10/17x2z2u+101/5xyz2u+15634y2z2u+1/107xz3u-9282yz3u+43/62z4u+62/55x3u2+100/113x2yu2-9205xy2u2-46/13y3u2+43/96x2zu2+10159xyzu2+692y2zu2+859xz2u2-19/74yz2u2+123/47z3u2-9/20x2u3-11391xyu3-2375y2u3+109/24xzu3-57/53yzu3-925z2u3-82/45xu4+97/34yu4+13/82zu4-108/29u5+63/10x3yv+38/17x2y2v-19/115xy3v+3150y4v+22/69x3zv+26/57x2yzv+110/27xy2zv+87/77y3zv+85/18x2z2v+39/47xyz2v-48/17y2z2v-7/27xz3v-13/100yz3v-11662z4v-17/8x3uv+37/11x2yuv+29/11xy2uv-109/88y3uv-2817x2zuv-61/44xyzuv+10/31y2zuv+10010xz2uv+51/86yz2uv-97/83z3uv-89/96x2u2v+4030xyu2v-58/77y2u2v-114/43xzu2v-37/10yzu2v-2011z2u2v+14483xu3v-109/101yu3v+121/102zu3v-79/92u4v+15113x3v2+10781x2yv2-14259xy2v2-113/48y3v2-7/94x2zv2-17/74xyzv2-5/117y2zv2-59/75xz2v2+13188yz2v2+103/43z3v2+4/125x2uv2-52/59xyuv2+85/92y2uv2-1/46xzuv2-9106yzuv2-83/11z2uv2-23/94xu2v2+6742yu2v2-35/107zu2v2-14596u3v2-117/43x2v3+1026xyv3+90/19y2v3+14671xzv3-101/100yzv3+6962z2v3+61/68xuv3+108/37yuv3-4157zuv3-3974u2v3+15677xv4+8661yv4+8459zv4-16/23uv4-37/119v5,13/89x3yz+12068x2y2z-15543xy3z-77/79y4z-12223x3z2-13941x2yz2+115/84xy2z2+13/98y3z2+82/99x2z3+7751xyz3+122/17y2z3-1491xz4+1327yz4+60/17z5+15363x3yu+9780x2y2u+19/117xy3u-1924y4u-14600x3zu+46/41x2yzu-5466xy2zu-73/12y3zu+10838x2z2u-8302xyz2u-89/113y2z2u+53/69xz3u-9224yz3u+47/33z4u-7399x3u2+89/77x2yu2+9312xy2u2-41/80y3u2-732x2zu2-6781xyzu2-8608y2zu2-9270xz2u2-117/58yz2u2-115/68z3u2-48/31x2u3-9067xyu3+97/107y2u3+73/57xzu3-2719yzu3-110/59z2u3-37/86xu4-15796yu4-61/4zu4-115/72u5+6161x3yv+4134x2y2v+677xy3v-8375y4v+1150x3zv+1551x2yzv+4157xy2zv+112/87y3zv+8171x2z2v+6040xyz2v+15651y2z2v-7/66xz3v-47/61yz3v+77/64z4v+14848x3uv+48/119x2yuv-9534xy2uv-117/95y3uv+5/4x2zuv+122xyzuv+90/31y2zuv-41/26xz2uv+31/30yz2uv-10428z3uv-9896x2u2v-71/21xyu2v-55/38y2u2v-29/22xzu2v-11092yzu2v+39/122z2u2v+93/73xu3v+22/49yu3v-21/106zu3v+56u4v+8565x3v2-1695x2yv2+2/17xy2v2+1/78y3v2-113/71x2zv2-41/100xyzv2+55/14y2zv2+15286xz2v2+17/53yz2v2+126/71z3v2-79/87x2uv2+109/97xyuv2-28/31y2uv2-6533xzuv2+22/5yzuv2-10449z2uv2+10830xu2v2-15516yu2v2+28/57zu2v2-81/22u3v2+4198x2v3+5667xyv3-7133y2v3-8408xzv3+11066yzv3-26/125z2v3-808xuv3+95/54yuv3-64/17zuv3-5267u2v3-15333xv4+42/89yv4+63/85zv4+119/113uv4-2011v5,5583x4y+1725x3y2-8652x2y3-91/25xy4-8495x4z-13731x3yz+9298x2y2z-41/111xy3z-15503y4z-13805x3z2+3962x2yz2-2/63xy2z2+3314y3z2+2522x2z3-10/87xyz3-408y2z3+7/16xz4+69/22yz4-7254z5-59/21x4u+115/7x3yu-1718x2y2u+7851xy3u+2632y4u-82/3x3zu+37/86x2yzu+101/113xy2zu+6747y3zu-109/113x2z2u+7399xyz2u+24/103y2z2u+89/9xz3u-14630yz3u+15066z4u-12561x3u2+113/115x2yu2+87/97xy2u2-126/67y3u2-48/7x2zu2+123/103xyzu2-11/107y2zu2-2747xz2u2+8158yz2u2-3/107z3u2+41/6x2u3+12767xyu3+3873y2u3+74/83xzu3-55/119yzu3-24/83z2u3+55xu4-7/95yu4+57/44zu4+2/101u5-6928x4v-121/57x3yv+111/104x2y2v+946xy3v-29y4v+3057x3zv-14/25x2yzv+43/31xy2zv-105/2y3zv+2336x2z2v+61/77xyz2v-7880y2z2v+5/58xz3v+10593yz3v+7094z4v+63/59x3uv-5/69x2yuv-11/81xy2uv-4157y3uv+73/65x2zuv-1676xyzuv-2376y2zuv-85/63xz2uv-95/2yz2uv-14903z3uv-119/110x2u2v-115/24xyu2v+125/9y2u2v+106/87xzu2v-13/12yzu2v-4/19z2u2v+7838xu3v-43/111yu3v+7/113zu3v-12500u4v+7743x3v2-2023x2yv2-85/83xy2v2+49/41y3v2+20/87x2zv2+3932xyzv2-77/6y2zv2+47/90xz2v2-15580yz2v2+39/4z3v2-61/8x2uv2+2518xyuv2+29/98y2uv2+11057xzuv2-18/107yzuv2+708z2uv2+14720xu2v2-3175yu2v2-113/59zu2v2-14735u3v2+7/69x2v3-4029xyv3+54/91y2v3+12372xzv3+67/2yzv3+8856z2v3-2178xuv3+995yuv3+64/95zuv3+4039u2v3-37/44xv4+23/17yv4-3035zv4-103/124uv4+69/64v5,-5583x3y2-1725x2y3+8652xy4+91/25y5+6201x3yz-73/49x2y2z-3844xy3z+10548y4z-11057x3z2-105/122x2yz2+31/53xy2z2+79/89y3z2-24/101x2z3+107/119xyz3-126y2z3+8164xz4+2/77yz4-51/8z5-14941x3yu-106x2y2u+8695xy3u+125/62y4u+4328x3zu+29/117x2yzu-6249xy2zu-2791y3zu+67/49x2z2u-38/29xyz2u+122/41y2z2u+10603xz3u-3029yz3u+5578z4u+14754x3u2-108/79x2yu2+4408xy2u2-12401y3u2-1426x2zu2-1741xyzu2-83/86y2zu2+79/95xz2u2+122/121yz2u2+81/2z3u2-1172x2u3-41/68xyu3-70/3y2u3+24/107xzu3+120/79yzu3+18/119z2u3-65/122xu4+1018yu4+22/107zu4+15189u5+5/8x3yv-12060x2y2v+3/62xy3v-227y4v+60/41x3zv-123/115x2yzv+110/123xy2zv+12864y3zv-86/121x2z2v-69/94xyz2v+14/79y2z2v+118/45xz3v+10842yz3v-37/58z4v+100/69x3uv-47/65x2yuv-7/67xy2uv-93/100y3uv-6262x2zuv-4/75xyzuv+2082y2zuv-9117xz2uv+12450yz2uv-84/67z3uv+123/26x2u2v-51/89xyu2v+19/74y2u2v-104/77xzu2v+318yzu2v+12402z2u2v+95/8xu3v-81/26yu3v-4486zu3v+3872u4v+72/91x3v2-83/63x2yv2+93/92xy2v2-15924y3v2-53/62x2zv2+6046xyzv2+1408y2zv2+60/107xz2v2-1150yz2v2-126/19z3v2-7429x2uv2+2554xyuv2+3602y2uv2+10738xzuv2-57/64yzuv2+86/69z2uv2+8172xu2v2+91/113yu2v2+92/65zu2v2+118/37u3v2+47/83x2v3+12750xyv3+10851y2v3+4216xzv3+6/101yzv3-108z2v3+2920xuv3-101/102yuv3-157zuv3+7742u2v3-7234xv4-2/111yv4+59/33zv4-93/91uv4+24/19v5,1592x4y+75/121x3y2+40/19x2y3-2651xy4+9934x4z+245x3yz+11665x2y2z+30/41xy3z+1823y4z+89/88x3z2-105/46x2yz2+79/58xy2z2-4191y3z2-76/61x2z3-21/32xyz3-9516y2z3-14896xz4-85/77yz4+51/109z5+61/30x4u-10/101x3yu+11796x2y2u+76/101xy3u+123/88y4u-5932x3zu-11857x2yzu+7128xy2zu-45/79y3zu+119/18x2z2u+9/74xyz2u+7042y2z2u-1114xz3u-11/82yz3u-1466z4u-6/85x3u2+27/106x2yu2+14246xy2u2-6216y3u2+47/6x2zu2-45/59xyzu2+89/41y2zu2+41/80xz2u2-7583yz2u2-75/113z3u2-14808x2u3-10873xyu3-90/67y2u3-11081xzu3-7369yzu3-7131z2u3-1402xu4-15386yu4-108/73zu4-5039u5+120/113x4v+10617x3yv-50/87x2y2v-2395xy3v-20/69y4v-8587x3zv+12960x2yzv-41/50xy2zv-13844y3zv-65/32x2z2v-77/122xyz2v-85/66y2z2v+13/100xz3v-20/51yz3v-13676z4v+76/97x3uv+1046x2yuv-8059xy2uv-117/59y3uv-29/105x2zuv+7287xyzuv-107/119y2zuv-35/118xz2uv+79/86yz2uv-2211z3uv+5448x2u2v+62/35xyu2v-2275y2u2v+29/121xzu2v-1674yzu2v-56/43z2u2v-3377xu3v-43/110yu3v+23/10zu3v-24/61u4v+121/53x3v2-4745x2yv2-57/64xy2v2+9554y3v2-12741x2zv2+10449xyzv2+37/108y2zv2+8621xz2v2-11/57yz2v2+1566z3v2+125/49x2uv2-121/118xyuv2+109/84y2uv2-335xzuv2+10167yzuv2-59/109z2uv2-103/119xu2v2+43/13yu2v2-73/87zu2v2+2037u3v2+13002x2v3+83/48xyv3-10713y2v3+1026xzv3-105/64yzv3-37/6z2v3+14779xuv3-6448yuv3+19/69zuv3-1/110u2v3+10010xv4+79/12yv4+12/19zv4-35/61uv4-11/57v5,-1592x3y2-75/121x2y3-40/19xy4+2651y5+39/121x3yz+122/77x2y2z-114/31xy3z+1544y4z+2/3x3z2-10271x2yz2-8373xy2z2+56/61y3z2+55/48x2z3-116xyz3-25/7y2z3-108/113xz4-34/53yz4+5548z5-122x3yu-9690x2y2u+43/87xy3u-5/19y4u+97/54x3zu-17/19x2yzu+4355xy2zu+12/5y3zu-1/100x2z2u+12754xyz2u+13600y2z2u+17/45xz3u-12091yz3u+5145z4u-63/64x3u2-84/31x2yu2-97/41xy2u2+7/13y3u2-79/62x2zu2-80/103xyzu2-69/14y2zu2+119/4xz2u2-35/87yz2u2-13840z3u2+14101x2u3+7952xyu3-1857y2u3-9861xzu3+3180yzu3+75/107z2u3-250xu4-15134yu4+4717zu4-2/41u5+22/27x3yv-8983x2y2v+10520xy3v-113/2y4v+10/73x3zv-1986x2yzv-110/13xy2zv+1550y3zv+32/111x2z2v-111/35xyz2v+101/98y2z2v+8045xz3v-2/89yz3v+2924z4v-79/11x3uv-15178x2yuv+10874xy2uv+54/11y3uv-8950x2zuv+70/53xyzuv-2403y2zuv-8249xz2uv+6935yz2uv+20/89z3uv+885x2u2v-76/71xyu2v-4/17y2u2v-31/52xzu2v-4/99yzu2v+10333z2u2v-93/104xu3v+82/101yu3v-71/37zu3v+9397u4v-15/112x3v2-6614x2yv2+119/2xy2v2+88/119y3v2+306x2zv2+2790xyzv2+10992y2zv2-115/74xz2v2-14711yz2v2+11612z3v2-1788x2uv2-75/97xyuv2+79/30y2uv2+99/59xzuv2-11439yzuv2-121/113z2uv2+108/37xu2v2+37/36yu2v2-3/65zu2v2-55/42u3v2+13/100x2v3-209xyv3-1272y2v3-117/68xzv3+63/94yzv3+32/59z2v3+1013xuv3-3463yuv3+6946zuv3-37/86u2v3+67/117xv4+85/28yv4-3024zv4-82/9uv4-32/65v5,-35/52x4y-12140x3y2+23/83x2y3+69/5xy4-80/79y5+120/43x4z-11865x3yz-3487x2y2z+53/59xy3z+53/102y4z-14083x3z2-14430x2yz2-2442xy2z2-33/104y3z2-91/38x2z3+4/87xyz3-26/57y2z3+4097xz4-9/122yz4+6364z5+9634x4u-97/95x3yu-46/99x2y2u+3847xy3u+121/106y4u+12765x3zu-5292x2yzu+1607xy2zu-67/121y3zu-12/35x2z2u+4/55xyz2u-17/27y2z2u+91/122xz3u-23/31yz3u+65/49z4u+73/46x3u2-124/27x2yu2-9933xy2u2+46/75y3u2+53/114x2zu2+3503xyzu2-14147y2zu2-11283xz2u2+11889yz2u2+99/104z3u2+3117x2u3+12624xyu3-10060y2u3+2193xzu3-80/47yzu3-77/13z2u3+11/31xu4-47/90yu4+49/48zu4-2/105u5-92/61x4v+7443x3yv+35/76x2y2v+114/67xy3v-73/126y4v+97/107x3zv+9464x2yzv+10869xy2zv+15718y3zv-37/33x2z2v+124/13xyz2v-11/26y2z2v-61/40xz3v+91/100yz3v-18/103z4v+60/29x3uv+21/125x2yuv-11117xy2uv+11748y3uv-16/117x2zuv+18/103xyzuv-1711y2zuv+1872xz2uv-109/123yz2uv-18/113z3uv-26/103x2u2v+14140xyu2v+11065y2u2v+8686xzu2v-5/111yzu2v+30/101z2u2v-10501xu3v-36/113yu3v-73/74zu3v+12753u4v-43/52x3v2-76/15x2yv2-5793xy2v2+18/13y3v2+1/79x2zv2+84/23xyzv2-172y2zv2+86/77xz2v2+15/37yz2v2+11835z3v2-6482x2uv2+94/113xyuv2+10727y2uv2-102/41xzuv2+15914yzuv2-12973z2uv2-9038xu2v2-13107yu2v2+1533zu2v2+12549u3v2-13528x2v3+903xyv3+23/114y2v3-123/64xzv3-81/5yzv3+111/103z2v3+4734xuv3-33/20yuv3-7954zuv3-2478u2v3+15518xv4-6723yv4-14/31zv4-3482uv4+10919v5,-3/94x4y-12936x3y2+2/11x2y3+32/23xy4-15921y5+61/93x4z+82/111x3yz-93/2x2y2z-6659xy3z-97/90y4z+402x3z2-14586x2yz2-121/39xy2z2+68/7y3z2+1212x2z3-2980xyz3+49/52y2z3-72/89xz4+92/47yz4+8478z5+2733x4u-103/89x3yu+1166x2y2u-7/53xy3u-106/23y4u+677x3zu+907x2yzu+7891xy2zu-9014y3zu+76/47x2z2u+49/116xyz2u-49/78y2z2u+12261xz3u+118/105yz3u-126/13z4u-8812x3u2-97/120x2yu2-9534xy2u2+92/5y3u2-54/71x2zu2+94/103xyzu2+2256y2zu2+4182xz2u2-5798yz2u2-31/115z3u2-73/98x2u3+15822xyu3+1004y2u3-578xzu3+9494yzu3-6779z2u3+14506xu4+10/121yu4+58/27zu4-2817u5-19/119x4v+7128x3yv+75/64x2y2v-65/109xy3v+5129y4v-53/55x3zv+54/125x2yzv-3009xy2zv+6144y3zv+15601x2z2v+123/55xyz2v-58/77y2z2v-56/61xz3v+121/10yz3v-103/86z4v-93/25x3uv+94/123x2yuv-25/107xy2uv+14807y3uv+65/7x2zuv+87/44xyzuv+6605y2zuv+23/99xz2uv-413yz2uv-17/15z3uv-79/46x2u2v+15240xyu2v-42/67y2u2v+8932xzu2v-5888yzu2v-4204z2u2v+7002xu3v-36/97yu3v-1634zu3v+61/102u4v-14/33x3v2-6520x2yv2+9004xy2v2-67/36y3v2-7/8x2zv2-24/11xyzv2-9373y2zv2+1556xz2v2-79/74yz2v2-6691z3v2+108x2uv2-76/61xyuv2+220y2uv2-1191xzuv2-4/9yzuv2+4546z2uv2+12205xu2v2+9/22yu2v2+64/93zu2v2-44/125u3v2+292x2v3+41/74xyv3+16/79y2v3-15892xzv3+5733yzv3+6796z2v3-42/55xuv3+71/79yuv3-19/104zuv3-38/15u2v3+6436xv4+28/15yv4+87/55zv4+2270uv4-30/41v5,-117/4x3y+97/122x2y2-3618xy3+6566y4+97/113x3z-12634x2yz+9865xy2z-1764y3z+114/31x2z2+5006xyz2+7/44y2z2-15040xz3+8/125yz3+11134z4-12980x3u-79/41x2yu-79/98xy2u+89/65y3u-1217x2zu+89/87xyzu+83/66y2zu+115/11xz2u+123/107yz2u+10920z3u-86/73x2u2-11/94xyu2-14054y2u2+6752xzu2-123/124yzu2+12129z2u2-13310xu3-52/63yu3+12847zu3-1545u4-11064x3v+11499x2yv-37/64xy2v+50/103y3v+123/94x2zv-126xyzv-111/44y2zv+95/14xz2v+113/83yz2v-77/103z3v+41/64x2uv+91/90xyuv-4932y2uv+103/31xzuv+62/63yzuv+1161z2uv-99/106xu2v-3181yu2v-11741zu2v-33/8u3v-3/118x2v2-9369xyv2+527y2v2-113/39xzv2-88/49yzv2-113/101z2v2+95/68xuv2-5930yuv2-20/43zuv2+7/41u2v2+109/93xv3-107/61yv3-8352zv3-5255uv3+12021v4,-2159x4-94/3x3y-4602x2y2+1609xy3+10721y4+28/9x3z-99/35x2yz+1/110xy2z+113/114y3z-118/75x2z2-103/93xyz2-68/67y2z2+13687xz3-1531yz3+61/107z4+6076x3u+9004x2yu+2211xy2u+110/53y3u+47/102x2zu+8495xyzu-9238y2zu+57/121xz2u-8543yz2u+8/19z3u-13527x2u2-13293xyu2+1138y2u2+26/115xzu2+78/53yzu2-12556z2u2+7299xu3+70/19yu3-14687zu3+13559u4+113/9x3v-85/126x2yv-83/3xy2v-3/46y3v+1814x2zv+28/79xyzv+103/51y2zv+78/31xz2v-14387yz2v+1/88z3v+116/75x2uv-101/59xyuv-70/3y2uv+109/71xzuv+13/88yzuv-147z2uv-113/76xu2v-9661yu2v+13855zu2v-6162u3v-1857x2v2-8208xyv2-4634y2v2-6178xzv2-7352yzv2-8247z2v2-113/15xuv2+99/40yuv2+21/97zuv2+11/37u2v2-6605xv3+8964yv3+35/121zv3+8543uv3-6008v4;TestGRRes(Name, I); kill R, Name, @p; "";

//  if( defined(assumeLevel0) ){ assumeLevel = assumeLevel0; } else { kill assumeLevel; } // restore the state of aL
}

/////////////////////////////////////////////////////////

proc grzero()
"USAGE:  grzero()
RETURN:  graded object representing S(0)^1
PURPOSE: compute presentation of S(0)^1
EXAMPLE: example grzero; shows an example
"
{
 return ( grobj(freemodule(0), intvec(0:0), intvec(0:0)) );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;


  grview( grobj(freemodule(0), intvec(0:0), intvec(0:0)) );
  grview( grobj(freemodule(0), intvec(0:0)) );

  grview( grzero() );

//  def M = grpower( grshift( grzero(), 3), 2 ); grview(M);
}

proc grtwists(intvec v)
"USAGE:  grtwists(v), intvec v
RETURN:  graded object representing S(v[1]) + ... + S(v[size(v)])
PURPOSE: compute presentation of S(v[1]) + ... + S(v[size(v)])
EXAMPLE: example grtwists; shows an example
"
{
  matrix m[size(v)][0];
  return( grobj(m, -v) ); // will set the rank as well
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  grview( grtwists ( intvec(-4, 1, 6 )) );

  grview( grtwists ( intvec(0:0) ) );
}

proc grtwist(int a, int d)
"USAGE:  grtwist(a,d), int a, d
RETURN:  graded object representing S(d)^a
PURPOSE: compute presentation of S(d)^a
EXAMPLE: example grtwist; shows an example
"
{
  ASSUME(0, a > 0);
  def Z = grtwists( intvec(d:a) ); // will set the rank as well
//  ASSUME(2, grisequal(Z, grpower( grshift(grzero(), d), a ) )); // optional check
  return(Z);
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

//  grview(grpower( grshift(grzero(), 10), 5 ) );

  grview( grtwist (5, 10) );
}

proc grpower(def A, int p)
"USAGE:  grpower(A, p), graded object A, int p > 0
RETURN:  graded direct power A^p
PURPOSE: compute the graded direct power A^p
NOTE:    the power p must be positive
EXAMPLE: example grpower; shows an example
"
{
  if(p==0){ ERROR("Sorry, we don't know what is A^0!?!?"); } // grzero!?

  ASSUME(0, p > 0);
  ASSUME(1, grtest(A) );

  if(p==1){ return(A); }

  def N = grsum(A,A);

  if(p==2){ return(N); }

  // TODO: replace recursion with a loop!
  // see http://en.wikipedia.org/wiki/Exponentiation_by_squaring
  if((p%2)==0)
    { return ( grpower(N, p div 2) ); }
  else
    { return ( grsum( A, grpower(N, (p-1) div 2) )); }
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module A = grobj( module([x+y, x, 0], [0, x+y, y]), intvec(1,1,1) );
  grview(A);

  module B = grobj( module([x,y]), intvec(2,2) );
  grview(B);

  module D = grsum( grpower(A,2), grpower(B,2) );

  print(D);
  homog(D);
  grview(D);
}


proc grsum(A,B)
"USAGE:  grsum(A, B), graded objects A and B
RETURN:  graded direct sum of input objects
PURPOSE: compute the graded direct sum of A and B
EXAMPLE: example grsum; shows an example
"
{
  ASSUME(1, grtest(A) );
  ASSUME(1, grtest(B) );

  intvec a = grrange(A);
  intvec b = grrange(B);
  intvec c = a,b;

  if( (ncols(B)>0) && (size(B)>0) )
  {
    int r = nrows(A);
    module T = align(module(B), r); //  T;  print(T);  nrows(T); // BUG!!!!
    module S = module(A), T;
  }
  else { def S = A; }

  intvec da = grdeg(A);
  intvec db = grdeg(B);
  intvec dc = da, db;


  def SS = grobj(S, c, dc);

  ASSUME(0, size( grrange(SS) ) == (size(a) + size(b)) );
  ASSUME(0, size( grdeg(SS) ) == (size(da) + size(db)) );
  ASSUME(0, ncols( SS ) == size( grdeg(SS) ) );
  ASSUME(0, nrows( SS ) == size( grrange(SS) ) );

  return(SS);
}
example
{ "EXAMPLE:"; echo = 2;

//  if( defined(assumeLevel) ){ int assumeLevel0 = assumeLevel; } else { int assumeLevel; export(assumeLevel); }; assumeLevel = 5;

  ring r=32003,(x,y,z),dp;

  module A = grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,1) );
  grview(A);

  module B = grobj( module([0,x,y]), intvec(15,1,1) );
  grview(B);

  module C = grsum(A,B);

  print(C);
  homog(C);
  grview(C);

  module D = grsum(
     grsum(grpower(A,2), grtwist(1,1)),
     grsum(grtwist(1,2), grpower(B,2))
     );

  print(D);
  homog(D);
  grview(D);

  module F = grobj( module([x,y,0]), intvec(1,1,5) );
  grview(F);

  module T = grsum( F, grsum( grtwist(1, 10), B ) );
  grview(T);

//  if( defined(assumeLevel0) ){ assumeLevel = assumeLevel0; } else { kill assumeLevel; } // restore the state of aL
}

proc grshift( def M, int d)
"USAGE:  grshift(A, d), graded objects A, int d
RETURN:  shifted graded object
PURPOSE: shift the grading on A by d: A(i) -> A(i+d)
EXAMPLE: example grshift; shows an example
"
{
  ASSUME(1, grtest(M) );



  intvec a = grrange(M);
  intvec t = grdeg(M);

  if( size(a) == 0 && size(t) == 0 )
  {
    "!! Warning: shifting '0 <- 0' leaves it as it unchanged!";
    return (M);
  }

  a = a - intvec(d:size(a));
  t = t - intvec(d:size(t));

  return (grobj(M, a, t));
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module A = grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,1) );

  grview(A);

  module S = grshift( A,  6);

  grview(S);

  grview( grshift( grzero(), 100 ) ); // does nothing...
}


proc grisequal (def A, def B)
"USAGE:  grisequal(A, B), graded objects A and B
RETURN:  1 if A == B as graded objects, 0 otherwise
PURPOSE: test the equality of two graded object
NOTE: A and B should be literarly the same at the moment. TODO?
EXAMPLE: example grisequal; shows an example
"
{
  ASSUME(1, grtest(A) );
  ASSUME(1, grtest(B) );

  int ra = nrows(A);
  int rb = nrows(B);

  intvec wa = grrange(A);
  intvec wb = grrange(B);

  if( (ra != rb) || (ncols(A) != ncols(B)) ){ return (0); } // TODO: ???

  intvec da = grdeg(A);
  intvec db = grdeg(B);

  return ( (da == db) && (wa == wb) &&
           (size(module(matrix(A) - matrix(B))) == 0)    ); // TODO: ???
}
example
{ "EXAMPLE:"; echo = 2;
//  TODO
}

proc grobj(def A, intvec w, list #)
"USAGE:  grobj(M, w[, d]), matrix/ideal/module M, intvec w, d
RETURN:  graded object with matrix presentation M, row weighting w [and total graded degrees d of columns]
PURPOSE: create a valid graded object with a given matrix presentation, weighting [and total graded degrees (in case of zero columns)]
EXAMPLE: example grobj; shows an example
"
{
  ASSUME(0, size(w) >= nrows(A) );

  module M = module(A);

  attrib( M, "rank", size(w) );
  attrib( M, "isHomog", w );

  intvec @ww = 0:0;

  if( size(#) > 0 )
  {
    ASSUME(0, typeof(#[1]) == "intvec" );

    @ww = intvec( #[1] );

    if( size(@ww) != ncols(M) )
    {
      if( (size(M) == 0) && (ncols(M) <= 1) && (size(w) == 0) && (size(@ww) > 0) )
      {
        matrix m[size(w)][size(@ww)]; M = module(m); attrib( M, "isHomog", w );
      }
    }

    ASSUME(0, size(@ww) == ncols(M) );
  }
  else
  {
    if( size(M) == ncols(M) ) /* no zero cols? */
    {
      @ww = grdeg(M); // let us compute them all :)
    } else
    {
      if( (ncols(M) == 1) && (size(M) == 0) )
      {
        M = freemodule(0);
      }

      attrib( M, "rank", size(w) );
      attrib( M, "isHomog", w );

//      ASSUME(0, /* PROBLEM WITH ZERO COLUMNS / THEIR DEGREES! */ (ncols(M) == 0) );
    }
  }

//  type(@ww);  type(M);

  ASSUME(0, size(@ww) == ncols(M) ); // ?!

  attrib(M, "degHomog", @ww);

  ASSUME(0, grtest(M) );
  return (M);
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  def A = grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,1) );
  grview(A);

  def F = grobj( module([x,y,0]), intvec(1,1,5) );
  grview(F);

  int d = 666; // zero can have any degree...
  def Z = grobj( module([x,0], [0,0,0], [0, y]), intvec(1,2,3), intvec(2, d, 3) );
  grview(Z);

  print(Z);
  attrib(Z);
  grrange(Z); // module weights
  attrib(Z, "degHomog"); // total degrees

  // Zero object:
  matrix z[3][0];  grview( grobj( z, intvec(1,2,3) ) );
  grview( grobj( freemodule(0), intvec(1,2,3) ) );

  matrix z1[0][3]; grview( grobj( z1, 0:0, intvec(1,2,3) ) );
  grview( grobj( freemodule(0), 0:0, intvec(1,2,3) ) );

  matrix z0[0][0]; grview( grobj( z0, 0:0 ) );
  grview( grobj( freemodule(0), 0:0 ) );



}

proc grtest(def N, list #)
"USAGE:  grtest(M[,b]), anyting M, optionally int b
RETURN:  1 if M is a valid graded object, 0 otherwise
PURPOSE: validate a graded object. Print an invalid object message if b is not given
NOTE: M should be an ideal or module or matrix, with weighting attribute
   'isHomog' and optionally total graded degrees attribute 'degHomog'.
   Attributes should be compatible with the presentation matrix.
EXAMPLE: example grtest; shows an example
"
{
  int b = (size(#) == 0);
  string t = typeof(N);
  if( (t != "ideal") && (t != "module") && (t != "matrix") )
  {
    if(b) { "   ? grtest: Input should be something like a matrix!"; };
    return (0);
  };

  if ( typeof(attrib(N,"isHomog")) != "intvec" )
  {
    if(b) { type(N); attrib(N); "   ? grtest: Input must be graded!";  };
    return (0);
  };

  intvec gr = grrange(N); // grading weights...
  if ( nrows(N) != size(gr) )
  {
    if(b) { "   ? grtest: Input has wrong number of rows!"; };
    return (0);
  };

  if( ncols(N) == 0 ) // zero-column matrix?
  {
    return(1);
  }

//  if( attrib(N, "rank") != size(gr) ){ return (0); } // wrong rank :(

  if ( typeof(attrib(N, "degHomog")) == "intvec" )
  {
    intvec T = attrib(N, "degHomog"); // graded degrees

    if( (ncols(N) == 1) && (size(T) == 0) && (size(N) == 0) )
    {
      //  if(b) { "Input seems to be a valid graded ZERO-arrow!"; };
      return (1);
    }

    if ( ncols(N) != size(T) )
    {
      if(b) { "   ? grtest: Input has wrong number of cols!"; };
      return (0);
    };

    int k = nvars(basering) + 1; // index of mod. column in the leadexp

    module L = lead(module(N)); vector v;

    // checking T for non-zero N[i]
    int i = size(T);

    for (; i > 0; i-- )
    {
      v = L[i];
      if( v != 0 )
      {
        if( (deg(v) + gr[ leadexp(v)[k] ]) != T[i] )
        {
          if(b) { "   ? grtest: Input has wrong total grade of " + string(i) + "-th column!"; };
          return (0);
        };  // wrong T[i]
      }
    }

    // TODO: check t on nonzero cols...
  } else
  {
    if( ncols(N) != size(N) )
    {
      if(b) { "   ? grtest: Input should have exclusively non-zero columns, please give total grades otherwise!"; };
      return (0);
    };
  }

  if( !homog(N) )
  {
    if(b) { "   ? grtest: Input should be graded homogenous!"; };
    return (0);
  };

//  if(b) { "Input seems to be a valid graded object (map)!"; };
  return (1);
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  // the following calls will fail due to tests in grtest:

 grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,0) ); // enough row weights
// grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0) ); // not enough row weights
// grobj( module([x,0], [0,0,0], [0, y]), intvec(1,2,3) ); // zero column needs (otherwise optional) total degrees
 grobj( module([x,0], [0,0,0], [0, y]), intvec(1,2,3), intvec(2, 10, 3) ); // compatible total degrees (on non-zero columns)
// grobj( module([x,0], [0,0,0], [0, y]), intvec(1,2,3), intvec(2-1, 10, 3+1) ); // incompatible total degrees (on both non-zero columns)

}


static proc align( def A, int d)
"analog of align kernel command for older Singular versions
 this is static since it should not be used by @code{align}-able (newer)
 Singular releases.
 Note that this proc does not care about any attributes (of A)
"
{
  ASSUME(0, d >= 0 );

  if( d == 0 ) { return (A); }

  if( ncols(A) == 0 )
  {
    matrix B[nrows(A) + d][0];
    return (B);
  }

  module T; T[d] = 0;
  T = T, module(transpose(A));
  return( module(transpose(T)) );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r;
  matrix m[2][0];
  type( align(m, 3) );

  matrix m[0][2];
  type( align(m, 3) );
}


proc grgroebner(A)
"USAGE:  grgroebner(M), graded object M
RETURN:  graded object
PURPOSE: compute graded groebner basis of M
EXAMPLE: example grgroebner; shows an example
"
{
  ASSUME(1, grtest(A));

  return ( grobj( groebner(A), grrange(A) ) );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module A = grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,1) );
  grview(A);

  module B = grgroebner(A);
  grview(B);
}

proc grsyz(A)
"USAGE:  grsyz(M), graded object M
RETURN:  graded object
PURPOSE: compute graded syzygy of M
EXAMPLE: example grsyz; shows an example
"
{
  ASSUME(1, grtest(A));
  return( grobj( syz(A), grdeg(A) ) );

//   if( size(syz(A)) == 0 ) : zero syzygy? //  return( grtwists( -grdeg(A) ) );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module A = grgroebner( grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) ) );
  grview(A);

  grview(grsyz(A));

  module X = grgroebner( grobj( module([x]), intvec(2) ) );
  grview(X);

  // syzygy module should be zero!
  grview(grsyz(X));


}


proc grprod(A, B)
"USAGE:  grprod(M, N), graded objects M and N
RETURN:  graded object
PURPOSE: compute graded product M * N (as composition of maps)
EXAMPLE: example grprod; shows an example
"
{
  ASSUME(1, grtest(A));
  ASSUME(1, grtest(B));

  intvec a = grdeg(A);
  intvec b = grrange(B);

  ASSUME(0, (size(a) == size(b)) && (a == b));  // == for intvec :(

  return ( grobj( A*B, grrange(A), grdeg(B) ) );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module A = grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) );
  grview(A);

  A = grgroebner(A);
  grview(A);

  module B = grsyz(A);
  grview(B);
  print(B);

  module D = grprod( A, B );
  grview(D);
  print(D); // must be all zeroes due to syzygy property!
  ASSUME(0, size(D) == 0);
}




// TODO: think about a proper data structure for a graded resolution!?
proc grres(def A, int l, list #)
"USAGE:  grres(M, l[, b]), graded object M, int l, int b
RETURN:  graded resolution = list of graded objects
PURPOSE: compute graded resolution of M (of length l) and minimise it if b was given
EXAMPLE: example grres; shows an example
"
{
  ASSUME(0, l >= 0);
  ASSUME(1, grtest(A));

  intvec v = grrange(A);

  int b = (size(#) > 0);
  if(b) { list r = res(A, l, #[1]); } else { list r = res(A, l); }

  l = size(r);

  int i;

  for ( i = 1; i <= l; i++ )
  {
    if( size(r[i]) == 0 )
    {
      r[i] = grobj(freemodule(0), v); // grtwists(-v);
      i++;
      break;
    }

    r[i] = grobj(r[i], v); v = grdeg(r[i]);
  }

  i = i-1;

  return( list(r[1..i]) );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module A = grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) );
  grview(A);

  module B = grgroebner(A);
  grview(B);

  "graded resolution of B: "; def C = grres(B, 0); grview(C);

  int i; int l = size(C);

  "D^2 == 0: "; for (i = 1; i < l; i++ ) { i; grview( grprod(C[i], C[i+1]) ); }
}

proc grtranspose(def M)
"USAGE:   grtranspose(M), graded object M
RETURN:  graded object
PURPOSE: graded transpose of M
NOTE:    no reordering is performend by this procedure
EXAMPLE: example grtranspose; shows an example
"
{
  ASSUME(1, grtest(M) );
  return (  grobj(transpose(M), -grdeg(M), -grrange(M))  );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module M = grtwists( intvec(-2, 0, 4, 4) ); grview(M);

  module N = grsyz( grtranspose( M ) ); grview(N);

  module L = grtranspose(N); grview( L );

  module K = grsyz( L ); grview(K);


  // Corner cases: 0 <- 0!
  module Z = grzero(); grview(Z);
  grview( grtranspose( Z ) );


  // Corner cases: * <- 0
  matrix M1[3][0];

  module Z1 = grobj( M1, intvec(-1, 0, 1) ); grview(Z1);
  grview( grtranspose( Z1 ) );


  // Corner cases: 0 <- *
  matrix M2[0][3];

  module Z2 = grobj( M2, 0:0, intvec(-1, 0, 1) ); grview(Z2);
  grview( grtranspose( Z2 ) );

}


proc grgens(def M)
"USAGE:   grgens(M), graded object M (map)
RETURN:  graded object
PURPOSE: try compute graded generators of coker(M) and return them as columns
         of a graded map.
NOTE:    presentation of resulting generated submodule may be different to M!
EXAMPLE: example grgens; shows an example
"
{
  ASSUME(1, grtest(M) );

  module N = grtranspose( grsyz( grtranspose(M) ) );

//  ASSUME(3, grisequal( grgroebner(M), grgroebner( grpres( N ) ) ) ); // FIXME: not always true!?

  return ( N );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module M = grtwists( intvec(-2, 0, 4, 4) ); grview(M);

  module N = grgens(M);

  grview( N ); print(N); // fine == M


  module A = grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) );

  A = grgroebner(A); grview(A);

  module B = grgens(A);

  grview( B ); print(B); // Ups :( != A

  grview( grgens( grzero() ) );

}


proc grpres(def M)
"USAGE:   grpres(M), graded object M (submodule gens)
RETURN:  graded module (via coker)
PURPOSE: compute graded presentation matrix of submodule generated by columns of M
EXAMPLE: example grpres; shows an example
"
{
  ASSUME(1, grtest(M) );

  def N = grsyz(M);

//  ASSUME(3, grisequal( M, grgens( N ) ) );

  return ( N );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  def A = grgroebner( grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) ) );
  grview(A);

  "graded transpose: "; def B = grtranspose(A); grview( B ); print(B);

  "... syzygy: "; def C = grsyz(B); grview(C);

  "... transposed: "; def D = grtranspose(C); grview( D ); print (D);

  "... and back to presentation: "; def E = grsyz( D ); grview(E); print(E);

  def F = grgens( E ); grview(F); print(F);
  def G = grpres( F ); grview(G); print(G);


  def M = grtwists( intvec(-2, 0, 4, 4) ); grview(M);

  def N = grgens(M); grview( N ); print(N);

  def L = grpres( N ); grview( L ); print(L);
}



LIB "random.lib"; // for sparsepoly

proc grrndmat(intvec w, intvec v, list #)
"USAGE:  grrndmat(src,dst[,p,b]), intvec src, dst[, int p, b]
RETURN:  matrix of polynomials
PURPOSE: generate random matrix compatible with src and dst gradings
NOTE:    optional arguments p, b are for 'sparsepoly' (by default: 75%, 30000).
TODO:    this is experimental at the moment!
EXAMPLE: example grrndmat; shows an example
"
{
  // defaults for sparsepoly
  int p = 75;
  int b = 30000;

  if ( size(#) > 0 )
  {
    ASSUME( 0, (typeof(#[1]) == "int") || (typeof(#[1]) == "bigint") );
    p = #[1];

    if ( size(#) > 1 )
    {
      ASSUME( 0, (typeof(#[2]) == "int") || (typeof(#[2]) == "bigint") );
      b = #[2];
    }
  }

  int n = size(v); // destination: rows!
  int m = size(w); // source: cols

  matrix M[n][m];

  int r,c; intvec ww;

  for( c = m; c > 0; c-- )
  {
    ww = v - intvec(w[c]:n);
    for( r = n; r > 0; r-- )
    {
      if( ww[r] >= 0)
      {
        M[r,c] = sparsepoly(ww[r], ww[r], p, b);
      }

    }
  }

  return(M);
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  print( grrndmat( intvec(0, 1), intvec(1, 2, 3) ) );
}

// TODO: remove the following?
proc KeneshlouMatrixPresentation(intvec a)
"USAGE: KeneshlouMatrixPresentation(intvec a), intvec a.
RETURN: graded object
PURPOSE: matrix presentation for direct sum of omega^a[i](i) in form of a graded object
EXAMPLE: example KeneshlouMatrixPresentation; shows an example
"
{
  int n = size(a)-1;
  //  ring r = 32003,(x(0..n)),dp;
  ASSUME(0, nvars(basering)==(n+1));
  int i,j;

  // find first nonzero exponent a_i
  for(i=1;i<=size(a);i++)
    {
      if(a[i]!=0) {break; };
    }

  // all zeroes?
  if(i>size(a)) {return (grzero()); };

  for(i=2;i<=n;i++)
    {
      if(a[i]!=0) {break; };
    }

  module N;

  if(i>n)
    { // no middle part
      if(a[1]>0)
        {
          N=grtwist(a[1],0);

          if(a[n+1]>0)
            { N=grsum(N,grtwist(a[n+1],-1));}
        }
      else
        { N=grtwist(a[n+1],-1);}

      return (N); // grorder(N));
    }
  else // i <= n: middle part is present, a_i != 0
    { // a = a1  ... |  i:2, a_2 ..... i: n, a_n | .... i: n+1a_(n+1)
      j = i - 1;
      module I = maxideal(1); attrib(I,"isHomog", intvec(0)); list L = mres(I, 0); // TODO: use grres() instead!!!
      list kos = grorder(L);
      // make sure that graded maps  are represented by blocks corresponding to the betti diagram?

      def S = grpower(grshift(grobj( kos[j+2], attrib(kos[j+2], "isHomog")), j), a[i]);

      i++;

      for(; i <= n; i++)
        {
          if(a[i]==0) { i++; continue; }
          j = i - 1;
          S = grsum( S, grpower(grshift( grobj( kos[j+2], attrib(kos[j+2], "isHomog")), j), a[i])  );
        }

      // S is the middle (non-zero) part

      if(a[1] > 0 )
        {
          N=grsum(grtwist(a[1],0), S);
        }
      else
        { N = S;}

      if(a[n+1] > 0 )
        { N=grsum(N, grtwist(a[n+1],-1)); }


      return ((N)); //      return (grorder(N));
    }
}
example
{ "EXAMPLE:"; echo = 2;
  ring r = 32003,(x(0..4)),dp;

  def N1 = KeneshlouMatrixPresentation(intvec(2,0,0,0,0));
  grview(N1);

  def N2 = KeneshlouMatrixPresentation(intvec(0,0,0,0,3));
  grview(N2);

  def N = KeneshlouMatrixPresentation(intvec(2,0,0,0,3));
  grview(N);


  def M1 = KeneshlouMatrixPresentation(intvec(0,1,0,0,0));
  grview(M1);

  def M2 = KeneshlouMatrixPresentation(intvec(0,1,1,0,0));
  grview(M2);

  def M3 = KeneshlouMatrixPresentation(intvec(0,0,0,1,0));
  grview(M3);

  def M = KeneshlouMatrixPresentation(intvec(1,1,1,0,0));
  grview(M);
}

proc grconcat(A,B)
"USAGE: grconcat(A, B), graded objects A and B, dst(A) == dst(B) =: dst
RETURN: graded object
PURPOSE: construct src(A) + src(B) -----> dst  given by (A|B)
EXAMPLE: example grconcat; shows an example
"
{

  ASSUME(1, grtest(A));
  ASSUME(1, grtest(B));
  ASSUME(0, grrange(A)==grrange(B));

  intvec v = grrange(A);
  intvec w=grdeg(A),grdeg(B);
  return(grobj(concat(A,B),v,w));
}
example
{ "EXAMPLE:"; echo = 2;
  ring r;

  module R=grobj(module([x,y,z]),intvec(0:3));
  grview(R);

  module S=grobj(module([x,0,y],[xy,zy+x2,0]),intvec(0:3));
  grview(S);

  def Q=grconcat(R,S);
  grview(Q);
}

proc grlift(A, B)
"USAGE: grlift(M, N), graded objects M and N
RETURN: transformation matrix (graded object???)
PURPOSE: compute graded matrix which the generators of submodule Im(N) in terms of Im(M).
EXAMPLE: example grlift; shows an example
"
{
  ASSUME(1, grtest(A));
  ASSUME(1, grtest(B));
  ASSUME(0, grrange(A) == grrange(B));

//  matrix T;  module AA = liftstd(A, T); //  AA = module(A*T)
//  matrix U;
  matrix L =lift(A,B/*,U*/);  //  module(B*U) = module(matrix(A)*L)

  return(grobj(L, grdeg(A), grdeg(B)));
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;
  module P=grobj(module([xy,0,xz]),intvec(0,1,0));
  grview(P);


  module D=grobj(module([y,0,z],[x2+y2,z,0]),intvec(0,1,0));
  grview(D);

  def G=grlift(D,P);
  grview(G);

  ASSUME(0, grisequal( grprod(D, G), P) );
}

proc grrange(M)
"USAGE: grrange(M), graded object M
RETURN: intvec
PURPOSE: get weights of module units, thus describing the target of M
EXAMPLE: example grrange; shows an example
"
{
//  ASSUME(1, grtest(M)); // Leads to recursive call due to grtest...
  return( attrib(M, "isHomog") );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module Z = grobj(freemodule(0),intvec(0:0),intvec(0:0));

  grrange(Z);
  grdeg(Z);

  grview(Z);

  module P=grobj(module([xy,0,xz]),intvec(0,1,0));

  grrange(P);
  grdeg(P);

  grview(P);
}

proc grlift0(M, N, alpha1)
"USAGE: grlift0(M, N, alpha1) TODO!
PURPOSE: generic random alpha0 : coker(M) -> coker(N) from random alpha1
NOTE: this proc can work only if some assumptions are fulfilled (due
to Wolfram)! e.g. at the end of a resolution for the source module...
"
{

  ASSUME(1, grtest(M));
  ASSUME(1, grtest(N));

  ASSUME(0, grdeg(M) == grdeg(alpha1) );
  ASSUME(0, grdeg(N) == grrange(alpha1) );
  return(
   grtranspose( grlift( grtranspose( M ),
       grtranspose( grprod( N,  alpha1 ) ) )
       ) ); // alpha0!

}
example
{ "EXAMPLE:"; echo = 2;

  ring S = 0, (x(0..3)), dp;
  list kos = grres(grobj(maxideal(1), intvec(0)), 0);
  print( betti(kos), "betti");
  grview(kos);


  // source module:
//  module M = grshift(kos[4], 2); // phi, Syz_3(K(2))
  def M = KeneshlouMatrixPresentation(intvec(0,0,1,0));
//   grview( grres(M, 0) );
  grview(M);

  // destination module:
//   module N = grshift(kos[3], 1); // psi, Syz_2(K(1))
  def N = KeneshlouMatrixPresentation(intvec(0,1,0,0));
//  grview( grres(N, 0) );
  grview(N);

  // random graded of degree 0, homomorphism of free presentations:
  // alpha1: src(M) -> src (N)
  def alpha1 = grrndmap( M, N ); // alpha1
  grview(alpha1);

  // random graded of degree 0, homomorphism of free presentations:
  // alpha0: dst(M) -> dst (N)
  def alpha0 = grlift0(M, N, alpha1);
  grview(alpha0);

}


proc grlifting(M,N)
"USAGE: grlifting(M,N), graded objects M and N
RETURN: map of chain complexes (as a list)
PURPOSE: construct a map of chain complexes between free resolutions of Img(M) and Img(N).
EXAMPLE: example grlifting; shows an example
"
{  ASSUME(1, grtest(M));
   ASSUME(1, grtest(N));

   list rM=grres(M,0,1);
   list rN=grres(N,0,1);
   int i,j,k;

  for(i=1;i<=size(rM);i++)
  {
    if(size(rM[i])==0){break;}
  }

  for(j=1;j<=size(rN);j++)
  {
    if(size(rN[j])==0){break;}
  }
  int t=min(i,j);

  ASSUME(0, t >= 2);

  list P;

  "t: ", t;

  P[1]= grrndmap( rM[1], rN[1] ); // alpha1

  if(t==2){return(P[1]);}

  for(k=2; k<=t; k++)
  {
    P[k] = grlift( grprod(P[k-1],rM[k]), rN[k] );
     grview(P[k]);

  }

  return(P);

}
example
{ "EXAMPLE:"; echo = 2;
/*
  ring r=32003,(x,y,z),dp;

  module P=grobj(module([xy,0,xz]),intvec(0,1,0));
  grview(P);

  module D=grobj(module([y,0,z],[x2+y2,z,0]),intvec(0,1,0));
  grview(D);

  def G=grlifting(D,P);
  grview(G);

  kill r;
  ring r=32003,(x,y,z),dp;

  module D=grobj(module([y,0,z],[x2+y2,z,0], [z3, xy, xy2]),intvec(0,1,0));
  D = grgroebner(D);
  grview( grres(D, 0));

  def G=grlifting(D, D);
  grview(G);
*/

  ring S = 0, (x(0..3)), dp;
  list kos = grres(grobj(maxideal(1), intvec(0)), 0);
  print( betti(kos), "betti");
  grview(kos);

//  module M = grshift(kos[4], 2); // phi, Syz_3(K(2))
  def M = KeneshlouMatrixPresentation(intvec(0,0,1,0));
  grview( grres(M, 0) );

//   module N = grshift(kos[3], 1); // psi, Syz_2(K(1))
  def N = KeneshlouMatrixPresentation(intvec(0,1,0,0));
  grview( grres(N, 0) );

  grlifting(M, N); // grview(G);


//  def G=grlifting( grgens(M), grgens(N) );  grview(G);


}

proc mappingcone(M,N)
"USAGE: mappingcone(M,N), M,N graded objects
RETURN: chain complex (as a list)
PURPOSE: construct a free resolution of the cokernel of a random map between Img(M), and Img(N).
EXAMPLE: example mappingcone; shows an example
"
{
  ASSUME(1, grtest(M));
  ASSUME(1, grtest(N));

  list P=grlifting(M,N);
  list rM=grres(M,1);
  list rN=grres(N,1);

  int i;
  list T;

  T[1]=grconcat(P[1],rN[2]);

  for(i=2;i<=size(P);i++)
  {
    intvec v=grrange(rM[i]);
    intvec w=grdeg(rN[i+1]);
    int r=size(v);
    int s=size(w);
    module zero = (0:s);

    module A=grconcat(P[i],rN[i+1]);
    module B=grobj(zero,v,w);
    module C=grconcat(-rM[i],B);
    module D=grconcat(grtranspose(C), grtranspose(A));

    T[i]=grtranspose(D);
  }
   return(T);
}
example
{ "EXAMPLE:"; echo = 2;

ring r=32003, (x(0..4)),dp;
def A=KeneshlouMatrixPresentation(intvec(0,0,0,0,3));
def M=grgens(A);
grview(M);

def B=KeneshlouMatrixPresentation(intvec(0,1,0,0,0));
def N=grgens(B);
grview(N);

def R=grlifting(M,N);
grview(R);
def T=mappingcone(M,N);
grview(T);

def U=grtranspose(T[1]);
resolution G=mres(U,0);
print(betti(G),"betti");
ideal I=groebner(flatten(G[2]));
resolution GI=mres(I,0);
print(betti(GI),"betti");
}

// correct
proc grrndmap(def S, def D, list #)
"USAGE: grrndmap(S,D), graded objects S and D
RETURN: graded object
PURPOSE: construct a random 0-deg graded homomorphism src(S) -> src(D)
EXAMPLE: example grrndmap; shows an example
"
{

ASSUME(1, grtest(S) );
ASSUME(1, grtest(D) );

// "src: "; grview(S);"dst: "; grview(D);

intvec v = -grdeg(S); // source
intvec w = -grdeg(D); // destination

return (grobj(grrndmat(v, w, #), -w, -v ) );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module D=grobj(module([y,0,z],[x2+y2,z,0]),intvec(0,1,0));
  grview(D);

  module S=grobj(module([x,0,y],[xy,zy+x2,0]),intvec(0,0,0));
  grview(S);

  def H=grrndmap(D,S);
  grview(H);

}

proc grrndmap2(def D, def S, list #)
"USAGE: grrndmap2(D,S), graded objects S and D
RETURN: graded object
PURPOSE: construct a random 0-deg graded homomorphism between target of D and S.
EXAMPLE: example grrndmap2; shows an example
"
{
  ASSUME(1, grtest(D) );
  ASSUME(1, grtest(S) );
  intvec v = -grrange(D); // source
  intvec w = -grrange(S); // target
  return (grobj(grrndmat(v, w, #), -w, -v ) );
}
example
{ "EXAMPLE:"; echo = 2;

  ring r=32003,(x,y,z),dp;

  module D=grobj(module([y,0,z],[x2+y2,z,0]),intvec(0,1,0));
  grview(D);

  module S=grobj(module([x,0,y],[xy,zy+x2,0]),intvec(0,0,0));
  grview(S);

  def G=grrndmap2(D,S);
  grview(G);
}


//                A     f2     f3
// 0<---M<----F0<----F1<----F2<----F3<----
//              |p1   |p2
//
// 0<---N<----G0<----G1<----G2<----G3<----
//                B(g1)      g2     g3
//
proc grlifting2(A,B)
"USAGE: grlifting2(A,B), graded objects A and B (matrices defining maps)
RETURN: map of chain complexes (as a list)
PURPOSE: construct a map of chain complexes between free resolution of
M=coker(A) and N=coker(B).
EXAMPLE: example grlifting2; shows an example
"
{  ASSUME(1, grtest(A));
   ASSUME(1, grtest(B));

   list rM=grres(A,0);
   list rN=grres(B,0);
   int i,j,k;
   list P;

  // find first zero matrix in rM
  for(i=1;i<=size(rM);i++)
  {
    if(size(rM[i])==0){break;}
  }

  // find first zero matrix in rN
  for(j=1;j<=size(rN);j++)
  {
    if(size(rN[j])==0){break;}
  }

  int t=min(i,j);

  P[1]=grrndmap2(A,B);

  // A(or B)=0
  if(t==1){return(P[1])};

  for(k=2;k<=t;k++)
  {
   def E=grprod(P[k-1],rM[k-1]);
   P[k]=grlift(rN[k-1],E); // ---------->
   /* let yi=(pi)o(fi); to take grlift(gi,yi)
      we should have img(yi) is contained in
      img(gi)=ker(gi-1),i.e (gi-1)oyi=0. we have
      (gi-1)oyi=(gi-1)o(pi)o(fi)=(pi-1)o(fi-1)ofi=0
  */
  }
  return(P);
}
example
{ "EXAMPLE:"; echo = 2;

ring r;
module P=grobj(module([xy,0,xz]),intvec(0,1,0));
grview(P);

module D=grobj(module([y,0,z],[x2+y2,z,0]),intvec(0,1,0));
grview(D);

module PP = grpres(P);
grview(PP);

module DD = grpres(D);
grview(DD);


def T=grlifting2(DD,PP); T;

// def Z=grlifting2(P,D); Z; // WRONG!!!

}

/*
//              -f1 0       -f2 0
//   (p1 g1)     p2 g2       p3 g3
// G0<-----F0+G1<------F1+G2<-------F2+G3<-----
proc mappingcone2(A,B)
"USAGE: mappingcone2(A,B), graded objects A and B (matrices defining maps)
RETURN: chain complex (as a list)
PURPOSE: construct the free resolution of a cokernel of a random map between M=coker(A), and N=coker(B)
EXAMPLE: example mappingcone2;
"
{
  ASSUME(1, grtest(A));
  ASSUME(1, grtest(B));

  list P=grlifting2(A,B);
  list rM=grres(A,1);
  list rN=grres(B,1);

  int i;
  list T;

  T[1]=grconcat(P[1],rN[1]);

  for(i=2;i<=size(P);i++)
  {
    intvec v=grrange(rM[i-1]);
    intvec w=grdeg(rN[i]);
    int r=size(v);
    int s=size(w);
    matrix zero[r][s];

    module A=grconcat(P[i],rN[i]);
    module B=grobj(zero,v,w);

    module C=grconcat( grneg( rM[i-1] ) ,B);
    module D=grconcat(grtranspose(C), grtranspose(A));

    T[i]=grtranspose(D);
  }
  return(T);
}
example
{ "EXAMPLE:"; echo = 2;

ring r=32003,(x(0..4)),dp;
def I=maxideal(1);
module R=grobj(module(I), intvec(0));
resolution FR=mres(R,0);
print(betti(FR,0),"betti");
module K=grobj(module(FR[1]),intvec(-1),intvec(0:5));
grview(K);

module S=grsyz(K);
grview(S);
S;

module SS = grpres(S);

module B=grobj(module([1,0,0],[0,1,0],[0,0,1]),intvec(1,1,1),intvec(1,1,1));
// module B=grobj(module([1],[0,1],[0,0,1],[0,0,0,1], [0,0,0,0,1]),intvec(0:5));
grview(B);
B;
module BB = grpres(B);

def Z=grlifting2(SS,BB);Z;
def G=mappingcone2(SS,BB);G;
}
*/

proc grlifting3(A,B)
"TODO: grlifting4 was newer and had more documentation than this proc, but was removed... Please verify and update!
"
{
  ASSUME(1, grtest(A));
  ASSUME(1, grtest(B));


  list rM = grres(A,0,1);

  print( betti(rM), "betti");
  list rN = grres(B,0,1);
  print( betti(rN), "betti");

  int i,j,k;

  for(i=1;i<=size(rM);i++)
  {
    if(size(rM[i])==0){break;}
  }

  for(j=1;j<=size(rN);j++)
  {
    if(size(rN[j])==0){break;}
  }
  int t=min(i,j);

  list P;

  "t: ", t;
//  grview(rM[t]);  grview(rN[t]);

  P[t]= grrndmap2(rM[t],rN[t]);
  grview(P[t]);

  if(t==1){return(P)};

  for(k=t-1; k>=1; k--)
  {
     "k: ", k;
//  grview(rM[k]);  grview(rN[k]);

// def C = grtranspose(rM[k]); def T= grprod(rN[k],P[k+1]);
// def tT = grtranspose(T);

    P[k]= grlift0( rM[k], rN[k], P[k+1] ); // grtranspose(grlift(C,tT));

     grview(P[k]);

   }
   return(P);
}
example
{"EXAMPLE:"; echo = 2;

ring r=32003, x(0..4),dp;

def A=grtwist(3,1);
grview(A);

def T=KeneshlouMatrixPresentation(intvec(0,1,0,0,0));
grview(T);

def F=grlifting3(T,A);
grview(F);

def R=KeneshlouMatrixPresentation(intvec(0,0,0,2,0));
def S=KeneshlouMatrixPresentation(intvec(1,2,0,0,0));

def H=grlifting3(R, S);
// grview(H);

// 2nd module does not lie in the first:
// def H=grlifting3(S, R);


//def I=KeneshlouMatrixPresentation(intvec(2,3,0,6,2));
//def J=KeneshlouMatrixPresentation(intvec(4,0,1,2,1));
//def N=grlifting3(I,J); grview(N);
}

proc grneg(A)
"USAGE: grneg(A), graded object A
RETURN: graded object
PURPOSE: graded map defined by -A
EXAMPLE: example grneg; shows an example
"
{
  ASSUME(1, grtest(A));
  return( grobj(-A, grrange(A), grdeg(A)) );
}
example
{ "EXAMPLE:"; echo = 2;

   ring r=0,(x,y,z),dp;
   def A=grobj([x2,yz,xyz],intvec(1,1,0));
   grview(A);

   def F=grneg(A);
   grview(F);
}

//             -f1 0        -f2 0
//  (p1 g1)     p2 g2        p3 g3
//G0<-----F0+G1<------F1+G2<-------F2+G3<-----
proc mappingcone3(A,B)
"USAGE: mappingcone3(A,B), graded objects A and B (matrices defining maps)
RETURN: chain complex (as a list)
PURPOSE: construct a free resolution of the cokernel of a random map between M=coker(A), and N=coker(B)
EXAMPLE: example mappingcone3; shows an example
"
{
  ASSUME(1, grtest(A));
  ASSUME(1, grtest(B));

  list P=grlifting3(A,B);
  list rM=grres(A,0,1);
  list rN=grres(B,0,1);

  int i;
  list T;

  T[1]=grconcat(P[1],rN[1]);

  for(i=2;i<=size(P);i++)
  {
    intvec v= grrange(rM[i-1]);
    intvec w=grdeg(rN[i]);
    int r=size(v);
    int s=size(w);
    matrix zero[r][s];

//    ASSUME( 0, grtest(P[i]) );
//    ASSUME( 0, grtest(rN[i]) );

    module A=grconcat(P[i],rN[i]);
    module B=grobj(zero,v,w);

    module C=grconcat( grneg( rM[i-1] ) ,B);
    module D=grconcat(grtranspose(C), grtranspose(A));

    T[i]=grtranspose(D);

    kill A, B, C, D, v, w, r, s, zero;
  }
   return(T);
}
example
{ "EXAMPLE:"; echo = 2;

ring r=32003,x(0..4),dp;

def A=KeneshlouMatrixPresentation(intvec(0,0,0,0,3));
grview(A);

def T= KeneshlouMatrixPresentation(intvec(0,1,0,0,0));
grview(T);

def F=grlifting3(A,T); grview(F);

// BUG in the proc
def G=mappingcone3(A,T); grview(G);

/*
module W=grtranspose(G[1]);
resolution U=mres(W,0);
print(betti(U,0),"betti"); // ?
ideal P=groebner(flatten(U[2]));
resolution L=mres(P,0);
print(betti(L),"betti");
*/


def R=KeneshlouMatrixPresentation(intvec(0,0,0,2,0));
grview(R);

def S=KeneshlouMatrixPresentation(intvec(1,2,0,0,0));
grview(S);

def H=grlifting3(R,S); grview(H);

// BUG in the proc
def G=mappingcone3(R,S);


def I=KeneshlouMatrixPresentation(intvec(2,3,0,6,2));
def J=KeneshlouMatrixPresentation(intvec(4,0,1,2,1));
// def N=grlifting3(I,J);
// 2nd module does not lie in the first:
// def NN=mappingcone3(I,J); // ????????

}




// TODO: Please decide between KeneshlouMatrixPresentation and matrixpres, and replace one with the other!
proc matrixpres(intvec a)
"USAGE:  matrixpres(a), intvec a
RETURN:  graded object
PURPOSE: matrix presentation for direct sum of omega^a[i](i) in form of a graded object
EXAMPLE: example matrixpres; shows an example
"
{
  int n = size(a)-1;
  //  ring r = 32003,(x(0..n)),dp;
  ASSUME(0, nvars(basering)==(n+1));
  int i,j;

  // find first nonzero exponent a_i
  for(i=1;i<=size(a);i++)
    {
      if(a[i]!=0) {break; };
    }

  // all zeroes?
  if(i>size(a)) {return (grzero()); };
   for(i=2;i<=n;i++)
    {
      if(a[i]!=0) {break; };
    }

  module N;

  if(i>n)
    { // no middle part
      if(a[1]>0)
        {
          N=grtwist(a[1],-1);

          if(a[n+1]>0)
            { N=grsum(N,grtwist(a[n+1],0));}
        }
      else
        { N=grtwist(a[n+1],0);}

      return (N); // grorder(N));
    }

else // i <= n: middle part is present, a_i != 0
    { // a = a1  ... |  i:2, a_2 ..... i: n, a_n | .... i: n+1a_(n+1)
      module I = maxideal(1);
      attrib(I,"isHomog", intvec(0));
      list L = mres(I, 0);
      list kos = grorder(L);
      // make sure that graded maps  are represented by blocks corresponding to the betti diagram?
      int j=size(a)-i;
      def S = grpower(grshift(grobj( kos[j+2], attrib(kos[j+2], "isHomog")),j ), a[i]);

      i++;

      for(; i <= n; i++)
        {
          if(a[i]==0) { i++; continue; }
          int j=size(a)-i;
          S = grsum( S, grpower(grshift( grobj( kos[j+2], attrib(kos[j+2], "isHomog")), j), a[i])  );
        }

      // S is the middle (non-zero) part

      if(a[1] > 0 )
        {
          N=grsum(grtwist(a[1],-1), S);
        }
      else
        { N = S;}

      if(a[n+1] > 0 )
        { N=grsum(N, grtwist(a[n+1],0)); }


      return ((N)); //      return (grorder(N));
    }
}
example
{ "EXAMPLE:"; echo = 2;

ring r = 32003,(x(0..4)),dp;

def R=matrixpres(intvec(1,4,0,0,0));
grview(R);
def S=matrixpres(intvec(0,0,3,0,0));
grview(S);

def N1 = matrixpres(intvec(2,0,0,0,0));
grview(N1);

def N2 = matrixpres(intvec(0,0,0,0,3));
grview(N2);

def N = matrixpres(intvec(2,0,0,0,3));
grview(N);


def M1 = matrixpres(intvec(0,1,0,0,0));
grview(M1);

def M2 = matrixpres(intvec(0,1,1,0,0));
grview(M2);

def M3 = matrixpres(intvec(0,0,0,1,0));
grview(M3);

def M = matrixpres(intvec(1,1,1,0,0));
grview(M);
}