cavargas10 commited on
Commit
526b0e6
·
verified ·
1 Parent(s): 08ab988

Upload 2 files

Browse files
trellis/representations/mesh/flexicube.py ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property
4
+ # and proprietary rights in and to this software, related documentation
5
+ # and any modifications thereto. Any use, reproduction, disclosure or
6
+ # distribution of this software and related documentation without an express
7
+ # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited.
8
+
9
+ import torch
10
+ from .tables import *
11
+
12
+ __all__ = [
13
+ 'FlexiCubes'
14
+ ]
15
+
16
+
17
+ class FlexiCubes:
18
+ def __init__(self, device="cuda"):
19
+
20
+ self.device = device
21
+ self.dmc_table = torch.tensor(dmc_table, dtype=torch.long, device=device, requires_grad=False)
22
+ self.num_vd_table = torch.tensor(num_vd_table,
23
+ dtype=torch.long, device=device, requires_grad=False)
24
+ self.check_table = torch.tensor(
25
+ check_table,
26
+ dtype=torch.long, device=device, requires_grad=False)
27
+
28
+ self.tet_table = torch.tensor(tet_table, dtype=torch.long, device=device, requires_grad=False)
29
+ self.quad_split_1 = torch.tensor([0, 1, 2, 0, 2, 3], dtype=torch.long, device=device, requires_grad=False)
30
+ self.quad_split_2 = torch.tensor([0, 1, 3, 3, 1, 2], dtype=torch.long, device=device, requires_grad=False)
31
+ self.quad_split_train = torch.tensor(
32
+ [0, 1, 1, 2, 2, 3, 3, 0], dtype=torch.long, device=device, requires_grad=False)
33
+
34
+ self.cube_corners = torch.tensor([[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], [0, 0, 1], [
35
+ 1, 0, 1], [0, 1, 1], [1, 1, 1]], dtype=torch.float, device=device)
36
+ self.cube_corners_idx = torch.pow(2, torch.arange(8, requires_grad=False))
37
+ self.cube_edges = torch.tensor([0, 1, 1, 5, 4, 5, 0, 4, 2, 3, 3, 7, 6, 7, 2, 6,
38
+ 2, 0, 3, 1, 7, 5, 6, 4], dtype=torch.long, device=device, requires_grad=False)
39
+
40
+ self.edge_dir_table = torch.tensor([0, 2, 0, 2, 0, 2, 0, 2, 1, 1, 1, 1],
41
+ dtype=torch.long, device=device)
42
+ self.dir_faces_table = torch.tensor([
43
+ [[5, 4], [3, 2], [4, 5], [2, 3]],
44
+ [[5, 4], [1, 0], [4, 5], [0, 1]],
45
+ [[3, 2], [1, 0], [2, 3], [0, 1]]
46
+ ], dtype=torch.long, device=device)
47
+ self.adj_pairs = torch.tensor([0, 1, 1, 3, 3, 2, 2, 0], dtype=torch.long, device=device)
48
+
49
+ def __call__(self, voxelgrid_vertices, scalar_field, cube_idx, resolution, qef_reg_scale=1e-3,
50
+ weight_scale=0.99, beta=None, alpha=None, gamma_f=None, voxelgrid_colors=None, training=False):
51
+ surf_cubes, occ_fx8 = self._identify_surf_cubes(scalar_field, cube_idx)
52
+ if surf_cubes.sum() == 0:
53
+ return (
54
+ torch.zeros((0, 3), device=self.device),
55
+ torch.zeros((0, 3), dtype=torch.long, device=self.device),
56
+ torch.zeros((0), device=self.device),
57
+ torch.zeros((0, voxelgrid_colors.shape[-1]), device=self.device) if voxelgrid_colors is not None else None
58
+ )
59
+ beta, alpha, gamma_f = self._normalize_weights(
60
+ beta, alpha, gamma_f, surf_cubes, weight_scale)
61
+
62
+ if voxelgrid_colors is not None:
63
+ voxelgrid_colors = torch.sigmoid(voxelgrid_colors)
64
+
65
+ case_ids = self._get_case_id(occ_fx8, surf_cubes, resolution)
66
+
67
+ surf_edges, idx_map, edge_counts, surf_edges_mask = self._identify_surf_edges(
68
+ scalar_field, cube_idx, surf_cubes
69
+ )
70
+
71
+ vd, L_dev, vd_gamma, vd_idx_map, vd_color = self._compute_vd(
72
+ voxelgrid_vertices, cube_idx[surf_cubes], surf_edges, scalar_field,
73
+ case_ids, beta, alpha, gamma_f, idx_map, qef_reg_scale, voxelgrid_colors)
74
+ vertices, faces, s_edges, edge_indices, vertices_color = self._triangulate(
75
+ scalar_field, surf_edges, vd, vd_gamma, edge_counts, idx_map,
76
+ vd_idx_map, surf_edges_mask, training, vd_color)
77
+ return vertices, faces, L_dev, vertices_color
78
+
79
+ def _compute_reg_loss(self, vd, ue, edge_group_to_vd, vd_num_edges):
80
+ """
81
+ Regularizer L_dev as in Equation 8
82
+ """
83
+ dist = torch.norm(ue - torch.index_select(input=vd, index=edge_group_to_vd, dim=0), dim=-1)
84
+ mean_l2 = torch.zeros_like(vd[:, 0])
85
+ mean_l2 = (mean_l2).index_add_(0, edge_group_to_vd, dist) / vd_num_edges.squeeze(1).float()
86
+ mad = (dist - torch.index_select(input=mean_l2, index=edge_group_to_vd, dim=0)).abs()
87
+ return mad
88
+
89
+ def _normalize_weights(self, beta, alpha, gamma_f, surf_cubes, weight_scale):
90
+ """
91
+ Normalizes the given weights to be non-negative. If input weights are None, it creates and returns a set of weights of ones.
92
+ """
93
+ n_cubes = surf_cubes.shape[0]
94
+
95
+ if beta is not None:
96
+ beta = (torch.tanh(beta) * weight_scale + 1)
97
+ else:
98
+ beta = torch.ones((n_cubes, 12), dtype=torch.float, device=self.device)
99
+
100
+ if alpha is not None:
101
+ alpha = (torch.tanh(alpha) * weight_scale + 1)
102
+ else:
103
+ alpha = torch.ones((n_cubes, 8), dtype=torch.float, device=self.device)
104
+
105
+ if gamma_f is not None:
106
+ gamma_f = torch.sigmoid(gamma_f) * weight_scale + (1 - weight_scale) / 2
107
+ else:
108
+ gamma_f = torch.ones((n_cubes), dtype=torch.float, device=self.device)
109
+
110
+ return beta[surf_cubes], alpha[surf_cubes], gamma_f[surf_cubes]
111
+
112
+ @torch.no_grad()
113
+ def _get_case_id(self, occ_fx8, surf_cubes, res):
114
+ """
115
+ Obtains the ID of topology cases based on cell corner occupancy. This function resolves the
116
+ ambiguity in the Dual Marching Cubes (DMC) configurations as described in Section 1.3 of the
117
+ supplementary material. It should be noted that this function assumes a regular grid.
118
+ """
119
+ case_ids = (occ_fx8[surf_cubes] * self.cube_corners_idx.to(self.device).unsqueeze(0)).sum(-1)
120
+
121
+ problem_config = self.check_table.to(self.device)[case_ids]
122
+ to_check = problem_config[..., 0] == 1
123
+ problem_config = problem_config[to_check]
124
+ if not isinstance(res, (list, tuple)):
125
+ res = [res, res, res]
126
+
127
+ # The 'problematic_configs' only contain configurations for surface cubes. Next, we construct a 3D array,
128
+ # 'problem_config_full', to store configurations for all cubes (with default config for non-surface cubes).
129
+ # This allows efficient checking on adjacent cubes.
130
+ problem_config_full = torch.zeros(list(res) + [5], device=self.device, dtype=torch.long)
131
+ vol_idx = torch.nonzero(problem_config_full[..., 0] == 0) # N, 3
132
+ vol_idx_problem = vol_idx[surf_cubes][to_check]
133
+ problem_config_full[vol_idx_problem[..., 0], vol_idx_problem[..., 1], vol_idx_problem[..., 2]] = problem_config
134
+ vol_idx_problem_adj = vol_idx_problem + problem_config[..., 1:4]
135
+
136
+ within_range = (
137
+ vol_idx_problem_adj[..., 0] >= 0) & (
138
+ vol_idx_problem_adj[..., 0] < res[0]) & (
139
+ vol_idx_problem_adj[..., 1] >= 0) & (
140
+ vol_idx_problem_adj[..., 1] < res[1]) & (
141
+ vol_idx_problem_adj[..., 2] >= 0) & (
142
+ vol_idx_problem_adj[..., 2] < res[2])
143
+
144
+ vol_idx_problem = vol_idx_problem[within_range]
145
+ vol_idx_problem_adj = vol_idx_problem_adj[within_range]
146
+ problem_config = problem_config[within_range]
147
+ problem_config_adj = problem_config_full[vol_idx_problem_adj[..., 0],
148
+ vol_idx_problem_adj[..., 1], vol_idx_problem_adj[..., 2]]
149
+ # If two cubes with cases C16 and C19 share an ambiguous face, both cases are inverted.
150
+ to_invert = (problem_config_adj[..., 0] == 1)
151
+ idx = torch.arange(case_ids.shape[0], device=self.device)[to_check][within_range][to_invert]
152
+ case_ids.index_put_((idx,), problem_config[to_invert][..., -1])
153
+ return case_ids
154
+
155
+ @torch.no_grad()
156
+ def _identify_surf_edges(self, scalar_field, cube_idx, surf_cubes):
157
+ """
158
+ Identifies grid edges that intersect with the underlying surface by checking for opposite signs. As each edge
159
+ can be shared by multiple cubes, this function also assigns a unique index to each surface-intersecting edge
160
+ and marks the cube edges with this index.
161
+ """
162
+ occ_n = scalar_field < 0
163
+ all_edges = cube_idx[surf_cubes][:, self.cube_edges].reshape(-1, 2)
164
+ unique_edges, _idx_map, counts = torch.unique(all_edges, dim=0, return_inverse=True, return_counts=True)
165
+
166
+ unique_edges = unique_edges.long()
167
+ mask_edges = occ_n[unique_edges.reshape(-1)].reshape(-1, 2).sum(-1) == 1
168
+
169
+ surf_edges_mask = mask_edges[_idx_map]
170
+ counts = counts[_idx_map]
171
+
172
+ mapping = torch.ones((unique_edges.shape[0]), dtype=torch.long, device=cube_idx.device) * -1
173
+ mapping[mask_edges] = torch.arange(mask_edges.sum(), device=cube_idx.device)
174
+ # Shaped as [number of cubes x 12 edges per cube]. This is later used to map a cube edge to the unique index
175
+ # for a surface-intersecting edge. Non-surface-intersecting edges are marked with -1.
176
+ idx_map = mapping[_idx_map]
177
+ surf_edges = unique_edges[mask_edges]
178
+ return surf_edges, idx_map, counts, surf_edges_mask
179
+
180
+ @torch.no_grad()
181
+ def _identify_surf_cubes(self, scalar_field, cube_idx):
182
+ """
183
+ Identifies grid cubes that intersect with the underlying surface by checking if the signs at
184
+ all corners are not identical.
185
+ """
186
+ occ_n = scalar_field < 0
187
+ occ_fx8 = occ_n[cube_idx.reshape(-1)].reshape(-1, 8)
188
+ _occ_sum = torch.sum(occ_fx8, -1)
189
+ surf_cubes = (_occ_sum > 0) & (_occ_sum < 8)
190
+ return surf_cubes, occ_fx8
191
+
192
+ def _linear_interp(self, edges_weight, edges_x):
193
+ """
194
+ Computes the location of zero-crossings on 'edges_x' using linear interpolation with 'edges_weight'.
195
+ """
196
+ edge_dim = edges_weight.dim() - 2
197
+ assert edges_weight.shape[edge_dim] == 2
198
+ edges_weight = torch.cat([torch.index_select(input=edges_weight, index=torch.tensor(1, device=self.device), dim=edge_dim), -
199
+ torch.index_select(input=edges_weight, index=torch.tensor(0, device=self.device), dim=edge_dim)]
200
+ , edge_dim)
201
+ denominator = edges_weight.sum(edge_dim)
202
+ ue = (edges_x * edges_weight).sum(edge_dim) / denominator
203
+ return ue
204
+
205
+ def _solve_vd_QEF(self, p_bxnx3, norm_bxnx3, c_bx3, qef_reg_scale):
206
+ p_bxnx3 = p_bxnx3.reshape(-1, 7, 3)
207
+ norm_bxnx3 = norm_bxnx3.reshape(-1, 7, 3)
208
+ c_bx3 = c_bx3.reshape(-1, 3)
209
+ A = norm_bxnx3
210
+ B = ((p_bxnx3) * norm_bxnx3).sum(-1, keepdims=True)
211
+
212
+ A_reg = (torch.eye(3, device=p_bxnx3.device) * qef_reg_scale).unsqueeze(0).repeat(p_bxnx3.shape[0], 1, 1)
213
+ B_reg = (qef_reg_scale * c_bx3).unsqueeze(-1)
214
+ A = torch.cat([A, A_reg], 1)
215
+ B = torch.cat([B, B_reg], 1)
216
+ dual_verts = torch.linalg.lstsq(A, B).solution.squeeze(-1)
217
+ return dual_verts
218
+
219
+ def _compute_vd(self, voxelgrid_vertices, surf_cubes_fx8, surf_edges, scalar_field,
220
+ case_ids, beta, alpha, gamma_f, idx_map, qef_reg_scale, voxelgrid_colors):
221
+ """
222
+ Computes the location of dual vertices as described in Section 4.2
223
+ """
224
+ alpha_nx12x2 = torch.index_select(input=alpha, index=self.cube_edges, dim=1).reshape(-1, 12, 2)
225
+ surf_edges_x = torch.index_select(input=voxelgrid_vertices, index=surf_edges.reshape(-1), dim=0).reshape(-1, 2, 3)
226
+ surf_edges_s = torch.index_select(input=scalar_field, index=surf_edges.reshape(-1), dim=0).reshape(-1, 2, 1)
227
+ zero_crossing = self._linear_interp(surf_edges_s, surf_edges_x)
228
+
229
+ if voxelgrid_colors is not None:
230
+ C = voxelgrid_colors.shape[-1]
231
+ surf_edges_c = torch.index_select(input=voxelgrid_colors, index=surf_edges.reshape(-1), dim=0).reshape(-1, 2, C)
232
+
233
+ idx_map = idx_map.reshape(-1, 12)
234
+ num_vd = torch.index_select(input=self.num_vd_table, index=case_ids, dim=0)
235
+ edge_group, edge_group_to_vd, edge_group_to_cube, vd_num_edges, vd_gamma = [], [], [], [], []
236
+
237
+ # if color is not None:
238
+ # vd_color = []
239
+
240
+ total_num_vd = 0
241
+ vd_idx_map = torch.zeros((case_ids.shape[0], 12), dtype=torch.long, device=self.device, requires_grad=False)
242
+
243
+ for num in torch.unique(num_vd):
244
+ cur_cubes = (num_vd == num) # consider cubes with the same numbers of vd emitted (for batching)
245
+ curr_num_vd = cur_cubes.sum() * num
246
+ curr_edge_group = self.dmc_table[case_ids[cur_cubes], :num].reshape(-1, num * 7)
247
+ curr_edge_group_to_vd = torch.arange(
248
+ curr_num_vd, device=self.device).unsqueeze(-1).repeat(1, 7) + total_num_vd
249
+ total_num_vd += curr_num_vd
250
+ curr_edge_group_to_cube = torch.arange(idx_map.shape[0], device=self.device)[
251
+ cur_cubes].unsqueeze(-1).repeat(1, num * 7).reshape_as(curr_edge_group)
252
+
253
+ curr_mask = (curr_edge_group != -1)
254
+ edge_group.append(torch.masked_select(curr_edge_group, curr_mask))
255
+ edge_group_to_vd.append(torch.masked_select(curr_edge_group_to_vd.reshape_as(curr_edge_group), curr_mask))
256
+ edge_group_to_cube.append(torch.masked_select(curr_edge_group_to_cube, curr_mask))
257
+ vd_num_edges.append(curr_mask.reshape(-1, 7).sum(-1, keepdims=True))
258
+ vd_gamma.append(torch.masked_select(gamma_f, cur_cubes).unsqueeze(-1).repeat(1, num).reshape(-1))
259
+ # if color is not None:
260
+ # vd_color.append(color[cur_cubes].unsqueeze(1).repeat(1, num, 1).reshape(-1, 3))
261
+
262
+ edge_group = torch.cat(edge_group)
263
+ edge_group_to_vd = torch.cat(edge_group_to_vd)
264
+ edge_group_to_cube = torch.cat(edge_group_to_cube)
265
+ vd_num_edges = torch.cat(vd_num_edges)
266
+ vd_gamma = torch.cat(vd_gamma)
267
+ # if color is not None:
268
+ # vd_color = torch.cat(vd_color)
269
+ # else:
270
+ # vd_color = None
271
+
272
+ vd = torch.zeros((total_num_vd, 3), device=self.device)
273
+ beta_sum = torch.zeros((total_num_vd, 1), device=self.device)
274
+
275
+ idx_group = torch.gather(input=idx_map.reshape(-1), dim=0, index=edge_group_to_cube * 12 + edge_group)
276
+
277
+ x_group = torch.index_select(input=surf_edges_x, index=idx_group.reshape(-1), dim=0).reshape(-1, 2, 3)
278
+ s_group = torch.index_select(input=surf_edges_s, index=idx_group.reshape(-1), dim=0).reshape(-1, 2, 1)
279
+
280
+
281
+ zero_crossing_group = torch.index_select(
282
+ input=zero_crossing, index=idx_group.reshape(-1), dim=0).reshape(-1, 3)
283
+
284
+ alpha_group = torch.index_select(input=alpha_nx12x2.reshape(-1, 2), dim=0,
285
+ index=edge_group_to_cube * 12 + edge_group).reshape(-1, 2, 1)
286
+ ue_group = self._linear_interp(s_group * alpha_group, x_group)
287
+
288
+ beta_group = torch.gather(input=beta.reshape(-1), dim=0,
289
+ index=edge_group_to_cube * 12 + edge_group).reshape(-1, 1)
290
+ beta_sum = beta_sum.index_add_(0, index=edge_group_to_vd, source=beta_group)
291
+ vd = vd.index_add_(0, index=edge_group_to_vd, source=ue_group * beta_group) / beta_sum
292
+
293
+ '''
294
+ interpolate colors use the same method as dual vertices
295
+ '''
296
+ if voxelgrid_colors is not None:
297
+ vd_color = torch.zeros((total_num_vd, C), device=self.device)
298
+ c_group = torch.index_select(input=surf_edges_c, index=idx_group.reshape(-1), dim=0).reshape(-1, 2, C)
299
+ uc_group = self._linear_interp(s_group * alpha_group, c_group)
300
+ vd_color = vd_color.index_add_(0, index=edge_group_to_vd, source=uc_group * beta_group) / beta_sum
301
+ else:
302
+ vd_color = None
303
+
304
+ L_dev = self._compute_reg_loss(vd, zero_crossing_group, edge_group_to_vd, vd_num_edges)
305
+
306
+ v_idx = torch.arange(vd.shape[0], device=self.device) # + total_num_vd
307
+
308
+ vd_idx_map = (vd_idx_map.reshape(-1)).scatter(dim=0, index=edge_group_to_cube *
309
+ 12 + edge_group, src=v_idx[edge_group_to_vd])
310
+
311
+ return vd, L_dev, vd_gamma, vd_idx_map, vd_color
312
+
313
+ def _triangulate(self, scalar_field, surf_edges, vd, vd_gamma, edge_counts, idx_map, vd_idx_map, surf_edges_mask, training, vd_color):
314
+ """
315
+ Connects four neighboring dual vertices to form a quadrilateral. The quadrilaterals are then split into
316
+ triangles based on the gamma parameter, as described in Section 4.3.
317
+ """
318
+ with torch.no_grad():
319
+ group_mask = (edge_counts == 4) & surf_edges_mask # surface edges shared by 4 cubes.
320
+ group = idx_map.reshape(-1)[group_mask]
321
+ vd_idx = vd_idx_map[group_mask]
322
+ edge_indices, indices = torch.sort(group, stable=True)
323
+ quad_vd_idx = vd_idx[indices].reshape(-1, 4)
324
+
325
+ # Ensure all face directions point towards the positive SDF to maintain consistent winding.
326
+ s_edges = scalar_field[surf_edges[edge_indices.reshape(-1, 4)[:, 0]].reshape(-1)].reshape(-1, 2)
327
+ flip_mask = s_edges[:, 0] > 0
328
+ quad_vd_idx = torch.cat((quad_vd_idx[flip_mask][:, [0, 1, 3, 2]],
329
+ quad_vd_idx[~flip_mask][:, [2, 3, 1, 0]]))
330
+
331
+ quad_gamma = torch.index_select(input=vd_gamma, index=quad_vd_idx.reshape(-1), dim=0).reshape(-1, 4)
332
+ gamma_02 = quad_gamma[:, 0] * quad_gamma[:, 2]
333
+ gamma_13 = quad_gamma[:, 1] * quad_gamma[:, 3]
334
+ if not training:
335
+ mask = (gamma_02 > gamma_13)
336
+ faces = torch.zeros((quad_gamma.shape[0], 6), dtype=torch.long, device=quad_vd_idx.device)
337
+ faces[mask] = quad_vd_idx[mask][:, self.quad_split_1]
338
+ faces[~mask] = quad_vd_idx[~mask][:, self.quad_split_2]
339
+ faces = faces.reshape(-1, 3)
340
+ else:
341
+ vd_quad = torch.index_select(input=vd, index=quad_vd_idx.reshape(-1), dim=0).reshape(-1, 4, 3)
342
+ vd_02 = (vd_quad[:, 0] + vd_quad[:, 2]) / 2
343
+ vd_13 = (vd_quad[:, 1] + vd_quad[:, 3]) / 2
344
+ weight_sum = (gamma_02 + gamma_13) + 1e-8
345
+ vd_center = (vd_02 * gamma_02.unsqueeze(-1) + vd_13 * gamma_13.unsqueeze(-1)) / weight_sum.unsqueeze(-1)
346
+
347
+ if vd_color is not None:
348
+ color_quad = torch.index_select(input=vd_color, index=quad_vd_idx.reshape(-1), dim=0).reshape(-1, 4, vd_color.shape[-1])
349
+ color_02 = (color_quad[:, 0] + color_quad[:, 2]) / 2
350
+ color_13 = (color_quad[:, 1] + color_quad[:, 3]) / 2
351
+ color_center = (color_02 * gamma_02.unsqueeze(-1) + color_13 * gamma_13.unsqueeze(-1)) / weight_sum.unsqueeze(-1)
352
+ vd_color = torch.cat([vd_color, color_center])
353
+
354
+
355
+ vd_center_idx = torch.arange(vd_center.shape[0], device=self.device) + vd.shape[0]
356
+ vd = torch.cat([vd, vd_center])
357
+ faces = quad_vd_idx[:, self.quad_split_train].reshape(-1, 4, 2)
358
+ faces = torch.cat([faces, vd_center_idx.reshape(-1, 1, 1).repeat(1, 4, 1)], -1).reshape(-1, 3)
359
+ return vd, faces, s_edges, edge_indices, vd_color
trellis/representations/mesh/tables.py ADDED
@@ -0,0 +1,791 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+ #
3
+ # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property
4
+ # and proprietary rights in and to this software, related documentation
5
+ # and any modifications thereto. Any use, reproduction, disclosure or
6
+ # distribution of this software and related documentation without an express
7
+ # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited.
8
+ dmc_table = [
9
+ [[-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
10
+ [[0, 3, 8, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
11
+ [[0, 1, 9, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
12
+ [[1, 3, 8, 9, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
13
+ [[4, 7, 8, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
14
+ [[0, 3, 4, 7, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
15
+ [[0, 1, 9, -1, -1, -1, -1], [4, 7, 8, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
16
+ [[1, 3, 4, 7, 9, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
17
+ [[4, 5, 9, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
18
+ [[0, 3, 8, -1, -1, -1, -1], [4, 5, 9, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
19
+ [[0, 1, 4, 5, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
20
+ [[1, 3, 4, 5, 8, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
21
+ [[5, 7, 8, 9, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
22
+ [[0, 3, 5, 7, 9, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
23
+ [[0, 1, 5, 7, 8, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
24
+ [[1, 3, 5, 7, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
25
+ [[2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
26
+ [[0, 2, 8, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
27
+ [[0, 1, 9, -1, -1, -1, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
28
+ [[1, 2, 8, 9, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
29
+ [[4, 7, 8, -1, -1, -1, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
30
+ [[0, 2, 4, 7, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
31
+ [[0, 1, 9, -1, -1, -1, -1], [4, 7, 8, -1, -1, -1, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
32
+ [[1, 2, 4, 7, 9, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
33
+ [[4, 5, 9, -1, -1, -1, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
34
+ [[0, 2, 8, 11, -1, -1, -1], [4, 5, 9, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
35
+ [[0, 1, 4, 5, -1, -1, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
36
+ [[1, 2, 4, 5, 8, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
37
+ [[5, 7, 8, 9, -1, -1, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
38
+ [[0, 2, 5, 7, 9, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
39
+ [[0, 1, 5, 7, 8, -1, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
40
+ [[1, 2, 5, 7, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
41
+ [[1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
42
+ [[0, 3, 8, -1, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
43
+ [[0, 2, 9, 10, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
44
+ [[2, 3, 8, 9, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
45
+ [[4, 7, 8, -1, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
46
+ [[0, 3, 4, 7, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
47
+ [[0, 2, 9, 10, -1, -1, -1], [4, 7, 8, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
48
+ [[2, 3, 4, 7, 9, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
49
+ [[4, 5, 9, -1, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
50
+ [[0, 3, 8, -1, -1, -1, -1], [4, 5, 9, -1, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
51
+ [[0, 2, 4, 5, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
52
+ [[2, 3, 4, 5, 8, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
53
+ [[5, 7, 8, 9, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
54
+ [[0, 3, 5, 7, 9, -1, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
55
+ [[0, 2, 5, 7, 8, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
56
+ [[2, 3, 5, 7, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
57
+ [[1, 3, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
58
+ [[0, 1, 8, 10, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
59
+ [[0, 3, 9, 10, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
60
+ [[8, 9, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
61
+ [[4, 7, 8, -1, -1, -1, -1], [1, 3, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
62
+ [[0, 1, 4, 7, 10, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
63
+ [[0, 3, 9, 10, 11, -1, -1], [4, 7, 8, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
64
+ [[4, 7, 9, 10, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
65
+ [[4, 5, 9, -1, -1, -1, -1], [1, 3, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
66
+ [[0, 1, 8, 10, 11, -1, -1], [4, 5, 9, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
67
+ [[0, 3, 4, 5, 10, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
68
+ [[4, 5, 8, 10, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
69
+ [[5, 7, 8, 9, -1, -1, -1], [1, 3, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
70
+ [[0, 1, 5, 7, 9, 10, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
71
+ [[0, 3, 5, 7, 8, 10, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
72
+ [[5, 7, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
73
+ [[6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
74
+ [[0, 3, 8, -1, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
75
+ [[0, 1, 9, -1, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
76
+ [[1, 3, 8, 9, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
77
+ [[4, 6, 8, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
78
+ [[0, 3, 4, 6, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
79
+ [[0, 1, 9, -1, -1, -1, -1], [4, 6, 8, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
80
+ [[1, 3, 4, 6, 9, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
81
+ [[4, 5, 9, -1, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
82
+ [[0, 3, 8, -1, -1, -1, -1], [4, 5, 9, -1, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
83
+ [[0, 1, 4, 5, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
84
+ [[1, 3, 4, 5, 8, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
85
+ [[5, 6, 8, 9, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
86
+ [[0, 3, 5, 6, 9, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
87
+ [[0, 1, 5, 6, 8, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
88
+ [[1, 3, 5, 6, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
89
+ [[2, 3, 6, 7, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
90
+ [[0, 2, 6, 7, 8, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
91
+ [[0, 1, 9, -1, -1, -1, -1], [2, 3, 6, 7, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
92
+ [[1, 2, 6, 7, 8, 9, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
93
+ [[2, 3, 4, 6, 8, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
94
+ [[0, 2, 4, 6, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
95
+ [[0, 1, 9, -1, -1, -1, -1], [2, 3, 4, 6, 8, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
96
+ [[1, 2, 4, 6, 9, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
97
+ [[4, 5, 9, -1, -1, -1, -1], [2, 3, 6, 7, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
98
+ [[0, 2, 6, 7, 8, -1, -1], [4, 5, 9, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
99
+ [[0, 1, 4, 5, -1, -1, -1], [2, 3, 6, 7, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
100
+ [[1, 2, 4, 5, 6, 7, 8], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
101
+ [[2, 3, 5, 6, 8, 9, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
102
+ [[0, 2, 5, 6, 9, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
103
+ [[0, 1, 2, 3, 5, 6, 8], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
104
+ [[1, 2, 5, 6, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
105
+ [[1, 2, 10, -1, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
106
+ [[0, 3, 8, -1, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
107
+ [[0, 2, 9, 10, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
108
+ [[2, 3, 8, 9, 10, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
109
+ [[4, 6, 8, 11, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
110
+ [[0, 3, 4, 6, 11, -1, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
111
+ [[0, 2, 9, 10, -1, -1, -1], [4, 6, 8, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
112
+ [[2, 3, 4, 6, 9, 10, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
113
+ [[4, 5, 9, -1, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
114
+ [[0, 3, 8, -1, -1, -1, -1], [4, 5, 9, -1, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1]],
115
+ [[0, 2, 4, 5, 10, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
116
+ [[2, 3, 4, 5, 8, 10, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
117
+ [[5, 6, 8, 9, 11, -1, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
118
+ [[0, 3, 5, 6, 9, 11, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
119
+ [[0, 2, 5, 6, 8, 10, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
120
+ [[2, 3, 5, 6, 10, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
121
+ [[1, 3, 6, 7, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
122
+ [[0, 1, 6, 7, 8, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
123
+ [[0, 3, 6, 7, 9, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
124
+ [[6, 7, 8, 9, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
125
+ [[1, 3, 4, 6, 8, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
126
+ [[0, 1, 4, 6, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
127
+ [[0, 3, 4, 6, 8, 9, 10], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
128
+ [[4, 6, 9, 10, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
129
+ [[4, 5, 9, -1, -1, -1, -1], [1, 3, 6, 7, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
130
+ [[0, 1, 6, 7, 8, 10, -1], [4, 5, 9, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
131
+ [[0, 3, 4, 5, 6, 7, 10], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
132
+ [[4, 5, 6, 7, 8, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
133
+ [[1, 3, 5, 6, 8, 9, 10], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
134
+ [[0, 1, 5, 6, 9, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
135
+ [[0, 3, 8, -1, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
136
+ [[5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
137
+ [[5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
138
+ [[0, 3, 8, -1, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
139
+ [[0, 1, 9, -1, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
140
+ [[1, 3, 8, 9, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
141
+ [[4, 7, 8, -1, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
142
+ [[0, 3, 4, 7, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
143
+ [[0, 1, 9, -1, -1, -1, -1], [4, 7, 8, -1, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
144
+ [[1, 3, 4, 7, 9, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
145
+ [[4, 6, 9, 10, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
146
+ [[0, 3, 8, -1, -1, -1, -1], [4, 6, 9, 10, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
147
+ [[0, 1, 4, 6, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
148
+ [[1, 3, 4, 6, 8, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
149
+ [[6, 7, 8, 9, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
150
+ [[0, 3, 6, 7, 9, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
151
+ [[0, 1, 6, 7, 8, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
152
+ [[1, 3, 6, 7, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
153
+ [[2, 3, 11, -1, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
154
+ [[0, 2, 8, 11, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
155
+ [[0, 1, 9, -1, -1, -1, -1], [2, 3, 11, -1, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
156
+ [[1, 2, 8, 9, 11, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
157
+ [[4, 7, 8, -1, -1, -1, -1], [2, 3, 11, -1, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
158
+ [[0, 2, 4, 7, 11, -1, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
159
+ [[0, 1, 9, -1, -1, -1, -1], [4, 7, 8, -1, -1, -1, -1], [2, 3, 11, -1, -1, -1, -1], [5, 6, 10, -1, -1, -1, -1]],
160
+ [[1, 2, 4, 7, 9, 11, -1], [5, 6, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
161
+ [[4, 6, 9, 10, -1, -1, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
162
+ [[0, 2, 8, 11, -1, -1, -1], [4, 6, 9, 10, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
163
+ [[0, 1, 4, 6, 10, -1, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
164
+ [[1, 2, 4, 6, 8, 10, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
165
+ [[6, 7, 8, 9, 10, -1, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
166
+ [[0, 2, 6, 7, 9, 10, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
167
+ [[0, 1, 6, 7, 8, 10, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
168
+ [[1, 2, 6, 7, 10, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
169
+ [[1, 2, 5, 6, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
170
+ [[0, 3, 8, -1, -1, -1, -1], [1, 2, 5, 6, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
171
+ [[0, 2, 5, 6, 9, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
172
+ [[2, 3, 5, 6, 8, 9, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
173
+ [[4, 7, 8, -1, -1, -1, -1], [1, 2, 5, 6, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
174
+ [[0, 3, 4, 7, -1, -1, -1], [1, 2, 5, 6, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
175
+ [[0, 2, 5, 6, 9, -1, -1], [4, 7, 8, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
176
+ [[2, 3, 4, 5, 6, 7, 9], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
177
+ [[1, 2, 4, 6, 9, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
178
+ [[0, 3, 8, -1, -1, -1, -1], [1, 2, 4, 6, 9, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
179
+ [[0, 2, 4, 6, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
180
+ [[2, 3, 4, 6, 8, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
181
+ [[1, 2, 6, 7, 8, 9, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
182
+ [[0, 1, 2, 3, 6, 7, 9], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
183
+ [[0, 2, 6, 7, 8, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
184
+ [[2, 3, 6, 7, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
185
+ [[1, 3, 5, 6, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
186
+ [[0, 1, 5, 6, 8, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
187
+ [[0, 3, 5, 6, 9, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
188
+ [[5, 6, 8, 9, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
189
+ [[4, 7, 8, -1, -1, -1, -1], [1, 3, 5, 6, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
190
+ [[0, 1, 4, 5, 6, 7, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
191
+ [[0, 3, 5, 6, 9, 11, -1], [4, 7, 8, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
192
+ [[4, 5, 6, 7, 9, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
193
+ [[1, 3, 4, 6, 9, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
194
+ [[0, 1, 4, 6, 8, 9, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
195
+ [[0, 3, 4, 6, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
196
+ [[4, 6, 8, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
197
+ [[1, 3, 6, 7, 8, 9, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
198
+ [[0, 1, 9, -1, -1, -1, -1], [6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
199
+ [[0, 3, 6, 7, 8, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
200
+ [[6, 7, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
201
+ [[5, 7, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
202
+ [[0, 3, 8, -1, -1, -1, -1], [5, 7, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
203
+ [[0, 1, 9, -1, -1, -1, -1], [5, 7, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
204
+ [[1, 3, 8, 9, -1, -1, -1], [5, 7, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
205
+ [[4, 5, 8, 10, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
206
+ [[0, 3, 4, 5, 10, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
207
+ [[0, 1, 9, -1, -1, -1, -1], [4, 5, 8, 10, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
208
+ [[1, 3, 4, 5, 9, 10, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
209
+ [[4, 7, 9, 10, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
210
+ [[0, 3, 8, -1, -1, -1, -1], [4, 7, 9, 10, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
211
+ [[0, 1, 4, 7, 10, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
212
+ [[1, 3, 4, 7, 8, 10, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
213
+ [[8, 9, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
214
+ [[0, 3, 9, 10, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
215
+ [[0, 1, 8, 10, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
216
+ [[1, 3, 10, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
217
+ [[2, 3, 5, 7, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
218
+ [[0, 2, 5, 7, 8, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
219
+ [[0, 1, 9, -1, -1, -1, -1], [2, 3, 5, 7, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
220
+ [[1, 2, 5, 7, 8, 9, 10], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
221
+ [[2, 3, 4, 5, 8, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
222
+ [[0, 2, 4, 5, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
223
+ [[0, 1, 9, -1, -1, -1, -1], [2, 3, 4, 5, 8, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
224
+ [[1, 2, 4, 5, 9, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
225
+ [[2, 3, 4, 7, 9, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
226
+ [[0, 2, 4, 7, 8, 9, 10], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
227
+ [[0, 1, 2, 3, 4, 7, 10], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
228
+ [[4, 7, 8, -1, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
229
+ [[2, 3, 8, 9, 10, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
230
+ [[0, 2, 9, 10, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
231
+ [[0, 1, 2, 3, 8, 10, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
232
+ [[1, 2, 10, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
233
+ [[1, 2, 5, 7, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
234
+ [[0, 3, 8, -1, -1, -1, -1], [1, 2, 5, 7, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
235
+ [[0, 2, 5, 7, 9, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
236
+ [[2, 3, 5, 7, 8, 9, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
237
+ [[1, 2, 4, 5, 8, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
238
+ [[0, 1, 2, 3, 4, 5, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
239
+ [[0, 2, 4, 5, 8, 9, 11], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
240
+ [[4, 5, 9, -1, -1, -1, -1], [2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
241
+ [[1, 2, 4, 7, 9, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
242
+ [[0, 3, 8, -1, -1, -1, -1], [1, 2, 4, 7, 9, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
243
+ [[0, 2, 4, 7, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
244
+ [[2, 3, 4, 7, 8, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
245
+ [[1, 2, 8, 9, 11, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
246
+ [[0, 1, 2, 3, 9, 11, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
247
+ [[0, 2, 8, 11, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
248
+ [[2, 3, 11, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
249
+ [[1, 3, 5, 7, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
250
+ [[0, 1, 5, 7, 8, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
251
+ [[0, 3, 5, 7, 9, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
252
+ [[5, 7, 8, 9, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
253
+ [[1, 3, 4, 5, 8, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
254
+ [[0, 1, 4, 5, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
255
+ [[0, 3, 4, 5, 8, 9, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
256
+ [[4, 5, 9, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
257
+ [[1, 3, 4, 7, 9, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
258
+ [[0, 1, 4, 7, 8, 9, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
259
+ [[0, 3, 4, 7, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
260
+ [[4, 7, 8, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
261
+ [[1, 3, 8, 9, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
262
+ [[0, 1, 9, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
263
+ [[0, 3, 8, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]],
264
+ [[-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1]]
265
+ ]
266
+ num_vd_table = [0, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 2, 2,
267
+ 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 2, 3, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2,
268
+ 1, 2, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 1, 1, 2, 1, 2, 3, 2, 2, 1, 1, 1, 1,
269
+ 1, 1, 2, 1, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 2, 2, 1, 3, 4, 2,
270
+ 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2,
271
+ 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 3, 2, 3, 2, 4, 2, 2, 2, 2, 1, 2, 1, 2, 1, 1,
272
+ 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1,
273
+ 1, 2, 1, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2,
274
+ 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
275
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]
276
+ check_table = [
277
+ [0, 0, 0, 0, 0],
278
+ [0, 0, 0, 0, 0],
279
+ [0, 0, 0, 0, 0],
280
+ [0, 0, 0, 0, 0],
281
+ [0, 0, 0, 0, 0],
282
+ [0, 0, 0, 0, 0],
283
+ [0, 0, 0, 0, 0],
284
+ [0, 0, 0, 0, 0],
285
+ [0, 0, 0, 0, 0],
286
+ [0, 0, 0, 0, 0],
287
+ [0, 0, 0, 0, 0],
288
+ [0, 0, 0, 0, 0],
289
+ [0, 0, 0, 0, 0],
290
+ [0, 0, 0, 0, 0],
291
+ [0, 0, 0, 0, 0],
292
+ [0, 0, 0, 0, 0],
293
+ [0, 0, 0, 0, 0],
294
+ [0, 0, 0, 0, 0],
295
+ [0, 0, 0, 0, 0],
296
+ [0, 0, 0, 0, 0],
297
+ [0, 0, 0, 0, 0],
298
+ [0, 0, 0, 0, 0],
299
+ [0, 0, 0, 0, 0],
300
+ [0, 0, 0, 0, 0],
301
+ [0, 0, 0, 0, 0],
302
+ [0, 0, 0, 0, 0],
303
+ [0, 0, 0, 0, 0],
304
+ [0, 0, 0, 0, 0],
305
+ [0, 0, 0, 0, 0],
306
+ [0, 0, 0, 0, 0],
307
+ [0, 0, 0, 0, 0],
308
+ [0, 0, 0, 0, 0],
309
+ [0, 0, 0, 0, 0],
310
+ [0, 0, 0, 0, 0],
311
+ [0, 0, 0, 0, 0],
312
+ [0, 0, 0, 0, 0],
313
+ [0, 0, 0, 0, 0],
314
+ [0, 0, 0, 0, 0],
315
+ [0, 0, 0, 0, 0],
316
+ [0, 0, 0, 0, 0],
317
+ [0, 0, 0, 0, 0],
318
+ [0, 0, 0, 0, 0],
319
+ [0, 0, 0, 0, 0],
320
+ [0, 0, 0, 0, 0],
321
+ [0, 0, 0, 0, 0],
322
+ [0, 0, 0, 0, 0],
323
+ [0, 0, 0, 0, 0],
324
+ [0, 0, 0, 0, 0],
325
+ [0, 0, 0, 0, 0],
326
+ [0, 0, 0, 0, 0],
327
+ [0, 0, 0, 0, 0],
328
+ [0, 0, 0, 0, 0],
329
+ [0, 0, 0, 0, 0],
330
+ [0, 0, 0, 0, 0],
331
+ [0, 0, 0, 0, 0],
332
+ [0, 0, 0, 0, 0],
333
+ [0, 0, 0, 0, 0],
334
+ [0, 0, 0, 0, 0],
335
+ [0, 0, 0, 0, 0],
336
+ [0, 0, 0, 0, 0],
337
+ [0, 0, 0, 0, 0],
338
+ [1, 1, 0, 0, 194],
339
+ [1, -1, 0, 0, 193],
340
+ [0, 0, 0, 0, 0],
341
+ [0, 0, 0, 0, 0],
342
+ [0, 0, 0, 0, 0],
343
+ [0, 0, 0, 0, 0],
344
+ [0, 0, 0, 0, 0],
345
+ [0, 0, 0, 0, 0],
346
+ [0, 0, 0, 0, 0],
347
+ [0, 0, 0, 0, 0],
348
+ [0, 0, 0, 0, 0],
349
+ [0, 0, 0, 0, 0],
350
+ [0, 0, 0, 0, 0],
351
+ [0, 0, 0, 0, 0],
352
+ [0, 0, 0, 0, 0],
353
+ [0, 0, 0, 0, 0],
354
+ [0, 0, 0, 0, 0],
355
+ [0, 0, 0, 0, 0],
356
+ [0, 0, 0, 0, 0],
357
+ [0, 0, 0, 0, 0],
358
+ [0, 0, 0, 0, 0],
359
+ [0, 0, 0, 0, 0],
360
+ [0, 0, 0, 0, 0],
361
+ [0, 0, 0, 0, 0],
362
+ [0, 0, 0, 0, 0],
363
+ [0, 0, 0, 0, 0],
364
+ [0, 0, 0, 0, 0],
365
+ [0, 0, 0, 0, 0],
366
+ [0, 0, 0, 0, 0],
367
+ [0, 0, 0, 0, 0],
368
+ [1, 0, 1, 0, 164],
369
+ [0, 0, 0, 0, 0],
370
+ [0, 0, 0, 0, 0],
371
+ [1, 0, -1, 0, 161],
372
+ [0, 0, 0, 0, 0],
373
+ [0, 0, 0, 0, 0],
374
+ [0, 0, 0, 0, 0],
375
+ [0, 0, 0, 0, 0],
376
+ [0, 0, 0, 0, 0],
377
+ [0, 0, 0, 0, 0],
378
+ [0, 0, 0, 0, 0],
379
+ [0, 0, 0, 0, 0],
380
+ [1, 0, 0, 1, 152],
381
+ [0, 0, 0, 0, 0],
382
+ [0, 0, 0, 0, 0],
383
+ [0, 0, 0, 0, 0],
384
+ [0, 0, 0, 0, 0],
385
+ [0, 0, 0, 0, 0],
386
+ [0, 0, 0, 0, 0],
387
+ [1, 0, 0, 1, 145],
388
+ [1, 0, 0, 1, 144],
389
+ [0, 0, 0, 0, 0],
390
+ [0, 0, 0, 0, 0],
391
+ [0, 0, 0, 0, 0],
392
+ [0, 0, 0, 0, 0],
393
+ [0, 0, 0, 0, 0],
394
+ [0, 0, 0, 0, 0],
395
+ [1, 0, 0, -1, 137],
396
+ [0, 0, 0, 0, 0],
397
+ [0, 0, 0, 0, 0],
398
+ [0, 0, 0, 0, 0],
399
+ [1, 0, 1, 0, 133],
400
+ [1, 0, 1, 0, 132],
401
+ [1, 1, 0, 0, 131],
402
+ [1, 1, 0, 0, 130],
403
+ [0, 0, 0, 0, 0],
404
+ [0, 0, 0, 0, 0],
405
+ [0, 0, 0, 0, 0],
406
+ [0, 0, 0, 0, 0],
407
+ [0, 0, 0, 0, 0],
408
+ [0, 0, 0, 0, 0],
409
+ [0, 0, 0, 0, 0],
410
+ [0, 0, 0, 0, 0],
411
+ [0, 0, 0, 0, 0],
412
+ [0, 0, 0, 0, 0],
413
+ [0, 0, 0, 0, 0],
414
+ [0, 0, 0, 0, 0],
415
+ [0, 0, 0, 0, 0],
416
+ [0, 0, 0, 0, 0],
417
+ [0, 0, 0, 0, 0],
418
+ [0, 0, 0, 0, 0],
419
+ [0, 0, 0, 0, 0],
420
+ [0, 0, 0, 0, 0],
421
+ [0, 0, 0, 0, 0],
422
+ [0, 0, 0, 0, 0],
423
+ [0, 0, 0, 0, 0],
424
+ [0, 0, 0, 0, 0],
425
+ [0, 0, 0, 0, 0],
426
+ [0, 0, 0, 0, 0],
427
+ [0, 0, 0, 0, 0],
428
+ [0, 0, 0, 0, 0],
429
+ [0, 0, 0, 0, 0],
430
+ [0, 0, 0, 0, 0],
431
+ [0, 0, 0, 0, 0],
432
+ [1, 0, 0, 1, 100],
433
+ [0, 0, 0, 0, 0],
434
+ [1, 0, 0, 1, 98],
435
+ [0, 0, 0, 0, 0],
436
+ [1, 0, 0, 1, 96],
437
+ [0, 0, 0, 0, 0],
438
+ [0, 0, 0, 0, 0],
439
+ [0, 0, 0, 0, 0],
440
+ [0, 0, 0, 0, 0],
441
+ [0, 0, 0, 0, 0],
442
+ [0, 0, 0, 0, 0],
443
+ [0, 0, 0, 0, 0],
444
+ [1, 0, 1, 0, 88],
445
+ [0, 0, 0, 0, 0],
446
+ [0, 0, 0, 0, 0],
447
+ [0, 0, 0, 0, 0],
448
+ [0, 0, 0, 0, 0],
449
+ [0, 0, 0, 0, 0],
450
+ [1, 0, -1, 0, 82],
451
+ [0, 0, 0, 0, 0],
452
+ [0, 0, 0, 0, 0],
453
+ [0, 0, 0, 0, 0],
454
+ [0, 0, 0, 0, 0],
455
+ [0, 0, 0, 0, 0],
456
+ [0, 0, 0, 0, 0],
457
+ [0, 0, 0, 0, 0],
458
+ [1, 0, 1, 0, 74],
459
+ [0, 0, 0, 0, 0],
460
+ [1, 0, 1, 0, 72],
461
+ [0, 0, 0, 0, 0],
462
+ [1, 0, 0, -1, 70],
463
+ [0, 0, 0, 0, 0],
464
+ [0, 0, 0, 0, 0],
465
+ [1, -1, 0, 0, 67],
466
+ [0, 0, 0, 0, 0],
467
+ [1, -1, 0, 0, 65],
468
+ [0, 0, 0, 0, 0],
469
+ [0, 0, 0, 0, 0],
470
+ [0, 0, 0, 0, 0],
471
+ [0, 0, 0, 0, 0],
472
+ [0, 0, 0, 0, 0],
473
+ [0, 0, 0, 0, 0],
474
+ [0, 0, 0, 0, 0],
475
+ [0, 0, 0, 0, 0],
476
+ [1, 1, 0, 0, 56],
477
+ [0, 0, 0, 0, 0],
478
+ [0, 0, 0, 0, 0],
479
+ [0, 0, 0, 0, 0],
480
+ [1, -1, 0, 0, 52],
481
+ [0, 0, 0, 0, 0],
482
+ [0, 0, 0, 0, 0],
483
+ [0, 0, 0, 0, 0],
484
+ [0, 0, 0, 0, 0],
485
+ [0, 0, 0, 0, 0],
486
+ [0, 0, 0, 0, 0],
487
+ [0, 0, 0, 0, 0],
488
+ [1, 1, 0, 0, 44],
489
+ [0, 0, 0, 0, 0],
490
+ [0, 0, 0, 0, 0],
491
+ [0, 0, 0, 0, 0],
492
+ [1, 1, 0, 0, 40],
493
+ [0, 0, 0, 0, 0],
494
+ [1, 0, 0, -1, 38],
495
+ [1, 0, -1, 0, 37],
496
+ [0, 0, 0, 0, 0],
497
+ [0, 0, 0, 0, 0],
498
+ [0, 0, 0, 0, 0],
499
+ [1, 0, -1, 0, 33],
500
+ [0, 0, 0, 0, 0],
501
+ [0, 0, 0, 0, 0],
502
+ [0, 0, 0, 0, 0],
503
+ [0, 0, 0, 0, 0],
504
+ [1, -1, 0, 0, 28],
505
+ [0, 0, 0, 0, 0],
506
+ [1, 0, -1, 0, 26],
507
+ [1, 0, 0, -1, 25],
508
+ [0, 0, 0, 0, 0],
509
+ [0, 0, 0, 0, 0],
510
+ [0, 0, 0, 0, 0],
511
+ [0, 0, 0, 0, 0],
512
+ [1, -1, 0, 0, 20],
513
+ [0, 0, 0, 0, 0],
514
+ [1, 0, -1, 0, 18],
515
+ [0, 0, 0, 0, 0],
516
+ [0, 0, 0, 0, 0],
517
+ [0, 0, 0, 0, 0],
518
+ [0, 0, 0, 0, 0],
519
+ [0, 0, 0, 0, 0],
520
+ [0, 0, 0, 0, 0],
521
+ [0, 0, 0, 0, 0],
522
+ [0, 0, 0, 0, 0],
523
+ [1, 0, 0, -1, 9],
524
+ [0, 0, 0, 0, 0],
525
+ [0, 0, 0, 0, 0],
526
+ [1, 0, 0, -1, 6],
527
+ [0, 0, 0, 0, 0],
528
+ [0, 0, 0, 0, 0],
529
+ [0, 0, 0, 0, 0],
530
+ [0, 0, 0, 0, 0],
531
+ [0, 0, 0, 0, 0],
532
+ [0, 0, 0, 0, 0]
533
+ ]
534
+ tet_table = [
535
+ [-1, -1, -1, -1, -1, -1],
536
+ [0, 0, 0, 0, 0, 0],
537
+ [0, 0, 0, 0, 0, 0],
538
+ [1, 1, 1, 1, 1, 1],
539
+ [4, 4, 4, 4, 4, 4],
540
+ [0, 0, 0, 0, 0, 0],
541
+ [4, 0, 0, 4, 4, -1],
542
+ [1, 1, 1, 1, 1, 1],
543
+ [4, 4, 4, 4, 4, 4],
544
+ [0, 4, 0, 4, 4, -1],
545
+ [0, 0, 0, 0, 0, 0],
546
+ [1, 1, 1, 1, 1, 1],
547
+ [5, 5, 5, 5, 5, 5],
548
+ [0, 0, 0, 0, 0, 0],
549
+ [0, 0, 0, 0, 0, 0],
550
+ [1, 1, 1, 1, 1, 1],
551
+ [2, 2, 2, 2, 2, 2],
552
+ [0, 0, 0, 0, 0, 0],
553
+ [2, 0, 2, -1, 0, 2],
554
+ [1, 1, 1, 1, 1, 1],
555
+ [2, -1, 2, 4, 4, 2],
556
+ [0, 0, 0, 0, 0, 0],
557
+ [2, 0, 2, 4, 4, 2],
558
+ [1, 1, 1, 1, 1, 1],
559
+ [2, 4, 2, 4, 4, 2],
560
+ [0, 4, 0, 4, 4, 0],
561
+ [2, 0, 2, 0, 0, 2],
562
+ [1, 1, 1, 1, 1, 1],
563
+ [2, 5, 2, 5, 5, 2],
564
+ [0, 0, 0, 0, 0, 0],
565
+ [2, 0, 2, 0, 0, 2],
566
+ [1, 1, 1, 1, 1, 1],
567
+ [1, 1, 1, 1, 1, 1],
568
+ [0, 1, 1, -1, 0, 1],
569
+ [0, 0, 0, 0, 0, 0],
570
+ [2, 2, 2, 2, 2, 2],
571
+ [4, 1, 1, 4, 4, 1],
572
+ [0, 1, 1, 0, 0, 1],
573
+ [4, 0, 0, 4, 4, 0],
574
+ [2, 2, 2, 2, 2, 2],
575
+ [-1, 1, 1, 4, 4, 1],
576
+ [0, 1, 1, 4, 4, 1],
577
+ [0, 0, 0, 0, 0, 0],
578
+ [2, 2, 2, 2, 2, 2],
579
+ [5, 1, 1, 5, 5, 1],
580
+ [0, 1, 1, 0, 0, 1],
581
+ [0, 0, 0, 0, 0, 0],
582
+ [2, 2, 2, 2, 2, 2],
583
+ [1, 1, 1, 1, 1, 1],
584
+ [0, 0, 0, 0, 0, 0],
585
+ [0, 0, 0, 0, 0, 0],
586
+ [8, 8, 8, 8, 8, 8],
587
+ [1, 1, 1, 4, 4, 1],
588
+ [0, 0, 0, 0, 0, 0],
589
+ [4, 0, 0, 4, 4, 0],
590
+ [4, 4, 4, 4, 4, 4],
591
+ [1, 1, 1, 4, 4, 1],
592
+ [0, 4, 0, 4, 4, 0],
593
+ [0, 0, 0, 0, 0, 0],
594
+ [4, 4, 4, 4, 4, 4],
595
+ [1, 1, 1, 5, 5, 1],
596
+ [0, 0, 0, 0, 0, 0],
597
+ [0, 0, 0, 0, 0, 0],
598
+ [5, 5, 5, 5, 5, 5],
599
+ [6, 6, 6, 6, 6, 6],
600
+ [6, -1, 0, 6, 0, 6],
601
+ [6, 0, 0, 6, 0, 6],
602
+ [6, 1, 1, 6, 1, 6],
603
+ [4, 4, 4, 4, 4, 4],
604
+ [0, 0, 0, 0, 0, 0],
605
+ [4, 0, 0, 4, 4, 4],
606
+ [1, 1, 1, 1, 1, 1],
607
+ [6, 4, -1, 6, 4, 6],
608
+ [6, 4, 0, 6, 4, 6],
609
+ [6, 0, 0, 6, 0, 6],
610
+ [6, 1, 1, 6, 1, 6],
611
+ [5, 5, 5, 5, 5, 5],
612
+ [0, 0, 0, 0, 0, 0],
613
+ [0, 0, 0, 0, 0, 0],
614
+ [1, 1, 1, 1, 1, 1],
615
+ [2, 2, 2, 2, 2, 2],
616
+ [0, 0, 0, 0, 0, 0],
617
+ [2, 0, 2, 2, 0, 2],
618
+ [1, 1, 1, 1, 1, 1],
619
+ [2, 2, 2, 2, 2, 2],
620
+ [0, 0, 0, 0, 0, 0],
621
+ [2, 0, 2, 2, 2, 2],
622
+ [1, 1, 1, 1, 1, 1],
623
+ [2, 4, 2, 2, 4, 2],
624
+ [0, 4, 0, 4, 4, 0],
625
+ [2, 0, 2, 2, 0, 2],
626
+ [1, 1, 1, 1, 1, 1],
627
+ [2, 2, 2, 2, 2, 2],
628
+ [0, 0, 0, 0, 0, 0],
629
+ [0, 0, 0, 0, 0, 0],
630
+ [1, 1, 1, 1, 1, 1],
631
+ [6, 1, 1, 6, -1, 6],
632
+ [6, 1, 1, 6, 0, 6],
633
+ [6, 0, 0, 6, 0, 6],
634
+ [6, 2, 2, 6, 2, 6],
635
+ [4, 1, 1, 4, 4, 1],
636
+ [0, 1, 1, 0, 0, 1],
637
+ [4, 0, 0, 4, 4, 4],
638
+ [2, 2, 2, 2, 2, 2],
639
+ [6, 1, 1, 6, 4, 6],
640
+ [6, 1, 1, 6, 4, 6],
641
+ [6, 0, 0, 6, 0, 6],
642
+ [6, 2, 2, 6, 2, 6],
643
+ [5, 1, 1, 5, 5, 1],
644
+ [0, 1, 1, 0, 0, 1],
645
+ [0, 0, 0, 0, 0, 0],
646
+ [2, 2, 2, 2, 2, 2],
647
+ [1, 1, 1, 1, 1, 1],
648
+ [0, 0, 0, 0, 0, 0],
649
+ [0, 0, 0, 0, 0, 0],
650
+ [6, 6, 6, 6, 6, 6],
651
+ [1, 1, 1, 1, 1, 1],
652
+ [0, 0, 0, 0, 0, 0],
653
+ [0, 0, 0, 0, 0, 0],
654
+ [4, 4, 4, 4, 4, 4],
655
+ [1, 1, 1, 1, 4, 1],
656
+ [0, 4, 0, 4, 4, 0],
657
+ [0, 0, 0, 0, 0, 0],
658
+ [4, 4, 4, 4, 4, 4],
659
+ [1, 1, 1, 1, 1, 1],
660
+ [0, 0, 0, 0, 0, 0],
661
+ [0, 5, 0, 5, 0, 5],
662
+ [5, 5, 5, 5, 5, 5],
663
+ [5, 5, 5, 5, 5, 5],
664
+ [0, 5, 0, 5, 0, 5],
665
+ [-1, 5, 0, 5, 0, 5],
666
+ [1, 5, 1, 5, 1, 5],
667
+ [4, 5, -1, 5, 4, 5],
668
+ [0, 5, 0, 5, 0, 5],
669
+ [4, 5, 0, 5, 4, 5],
670
+ [1, 5, 1, 5, 1, 5],
671
+ [4, 4, 4, 4, 4, 4],
672
+ [0, 4, 0, 4, 4, 4],
673
+ [0, 0, 0, 0, 0, 0],
674
+ [1, 1, 1, 1, 1, 1],
675
+ [6, 6, 6, 6, 6, 6],
676
+ [0, 0, 0, 0, 0, 0],
677
+ [0, 0, 0, 0, 0, 0],
678
+ [1, 1, 1, 1, 1, 1],
679
+ [2, 5, 2, 5, -1, 5],
680
+ [0, 5, 0, 5, 0, 5],
681
+ [2, 5, 2, 5, 0, 5],
682
+ [1, 5, 1, 5, 1, 5],
683
+ [2, 5, 2, 5, 4, 5],
684
+ [0, 5, 0, 5, 0, 5],
685
+ [2, 5, 2, 5, 4, 5],
686
+ [1, 5, 1, 5, 1, 5],
687
+ [2, 4, 2, 4, 4, 2],
688
+ [0, 4, 0, 4, 4, 4],
689
+ [2, 0, 2, 0, 0, 2],
690
+ [1, 1, 1, 1, 1, 1],
691
+ [2, 6, 2, 6, 6, 2],
692
+ [0, 0, 0, 0, 0, 0],
693
+ [2, 0, 2, 0, 0, 2],
694
+ [1, 1, 1, 1, 1, 1],
695
+ [1, 1, 1, 1, 1, 1],
696
+ [0, 1, 1, 1, 0, 1],
697
+ [0, 0, 0, 0, 0, 0],
698
+ [2, 2, 2, 2, 2, 2],
699
+ [4, 1, 1, 1, 4, 1],
700
+ [0, 1, 1, 1, 0, 1],
701
+ [4, 0, 0, 4, 4, 0],
702
+ [2, 2, 2, 2, 2, 2],
703
+ [1, 1, 1, 1, 1, 1],
704
+ [0, 1, 1, 1, 1, 1],
705
+ [0, 0, 0, 0, 0, 0],
706
+ [2, 2, 2, 2, 2, 2],
707
+ [1, 1, 1, 1, 1, 1],
708
+ [0, 0, 0, 0, 0, 0],
709
+ [0, 0, 0, 0, 0, 0],
710
+ [2, 2, 2, 2, 2, 2],
711
+ [1, 1, 1, 1, 1, 1],
712
+ [0, 0, 0, 0, 0, 0],
713
+ [0, 0, 0, 0, 0, 0],
714
+ [5, 5, 5, 5, 5, 5],
715
+ [1, 1, 1, 1, 4, 1],
716
+ [0, 0, 0, 0, 0, 0],
717
+ [4, 0, 0, 4, 4, 0],
718
+ [4, 4, 4, 4, 4, 4],
719
+ [1, 1, 1, 1, 1, 1],
720
+ [0, 0, 0, 0, 0, 0],
721
+ [0, 0, 0, 0, 0, 0],
722
+ [4, 4, 4, 4, 4, 4],
723
+ [1, 1, 1, 1, 1, 1],
724
+ [6, 0, 0, 6, 0, 6],
725
+ [0, 0, 0, 0, 0, 0],
726
+ [6, 6, 6, 6, 6, 6],
727
+ [5, 5, 5, 5, 5, 5],
728
+ [5, 5, 0, 5, 0, 5],
729
+ [5, 5, 0, 5, 0, 5],
730
+ [5, 5, 1, 5, 1, 5],
731
+ [4, 4, 4, 4, 4, 4],
732
+ [0, 0, 0, 0, 0, 0],
733
+ [4, 4, 0, 4, 4, 4],
734
+ [1, 1, 1, 1, 1, 1],
735
+ [4, 4, 4, 4, 4, 4],
736
+ [4, 4, 0, 4, 4, 4],
737
+ [0, 0, 0, 0, 0, 0],
738
+ [1, 1, 1, 1, 1, 1],
739
+ [8, 8, 8, 8, 8, 8],
740
+ [0, 0, 0, 0, 0, 0],
741
+ [0, 0, 0, 0, 0, 0],
742
+ [1, 1, 1, 1, 1, 1],
743
+ [2, 2, 2, 2, 2, 2],
744
+ [0, 0, 0, 0, 0, 0],
745
+ [2, 2, 2, 2, 0, 2],
746
+ [1, 1, 1, 1, 1, 1],
747
+ [2, 2, 2, 2, 2, 2],
748
+ [0, 0, 0, 0, 0, 0],
749
+ [2, 2, 2, 2, 2, 2],
750
+ [1, 1, 1, 1, 1, 1],
751
+ [2, 2, 2, 2, 2, 2],
752
+ [0, 0, 0, 0, 0, 0],
753
+ [0, 0, 0, 0, 0, 0],
754
+ [4, 1, 1, 4, 4, 1],
755
+ [2, 2, 2, 2, 2, 2],
756
+ [0, 0, 0, 0, 0, 0],
757
+ [0, 0, 0, 0, 0, 0],
758
+ [1, 1, 1, 1, 1, 1],
759
+ [1, 1, 1, 1, 1, 1],
760
+ [1, 1, 1, 1, 0, 1],
761
+ [0, 0, 0, 0, 0, 0],
762
+ [2, 2, 2, 2, 2, 2],
763
+ [1, 1, 1, 1, 1, 1],
764
+ [0, 0, 0, 0, 0, 0],
765
+ [0, 0, 0, 0, 0, 0],
766
+ [2, 4, 2, 4, 4, 2],
767
+ [1, 1, 1, 1, 1, 1],
768
+ [1, 1, 1, 1, 1, 1],
769
+ [0, 0, 0, 0, 0, 0],
770
+ [2, 2, 2, 2, 2, 2],
771
+ [1, 1, 1, 1, 1, 1],
772
+ [0, 0, 0, 0, 0, 0],
773
+ [0, 0, 0, 0, 0, 0],
774
+ [2, 2, 2, 2, 2, 2],
775
+ [1, 1, 1, 1, 1, 1],
776
+ [0, 0, 0, 0, 0, 0],
777
+ [0, 0, 0, 0, 0, 0],
778
+ [5, 5, 5, 5, 5, 5],
779
+ [1, 1, 1, 1, 1, 1],
780
+ [0, 0, 0, 0, 0, 0],
781
+ [0, 0, 0, 0, 0, 0],
782
+ [4, 4, 4, 4, 4, 4],
783
+ [1, 1, 1, 1, 1, 1],
784
+ [0, 0, 0, 0, 0, 0],
785
+ [0, 0, 0, 0, 0, 0],
786
+ [4, 4, 4, 4, 4, 4],
787
+ [1, 1, 1, 1, 1, 1],
788
+ [0, 0, 0, 0, 0, 0],
789
+ [0, 0, 0, 0, 0, 0],
790
+ [12, 12, 12, 12, 12, 12]
791
+ ]