groups = OrderedDict()
A = [[1, 2, 3], [1, 3, 7], [2, 1, 3], [8, 9, 6], [3, 7, 9], [2, 3, 8], [1, 
    2, 4]]
key = lambda l: l[0]
for sub in A:
    groups.setdefault(key(sub), []).append(sub)
groups
B = list(groups.values())
B
Most efficient way to break python list into sublists via key while preserving the order