//PascalABC.Net 3.1.0.1200
uses System;
var
A: array of integer := (1, 2, 4, 6);
B: array of integer := (1, 2, 4, 7, 8);
C: array of integer := (1, 4, 5, 6, 7, 8);
begin
var D := A.Intersect(C);
D := (B.Union(D)).Except(B.Intersect(D));
D := (D.Union(C)).Except(D.Intersect(C));
Println(D.Sorted);
end.