module maxmin4(
input [3:0] a,
input [3:0] b,
input [3:0] c,
input [3:0] d,
output reg [3:0] max,
output reg [3:0] min
);
reg [3:0] max1,max2;
reg [3:0] min1,min2;
always @(*) begin
max1 = a > b ? a : b;
max2 = c > d ? c : d;
max = max1 > max2 ? max1 : max2;
min1 = a < b ? a : b;
min2 = c < d ? c : d;
min = min1 < min2 ? min1 : min2;
end
endmodule