Solution
Represent each dwarf by a point. If two dwarves are friends, connect them with
a green segment (solid line); if they hate each other, connect them with a red segment (dashed line).
(A) No; it may happen that there are no three dwarves who are all pairwise friends,
for example, see Fig. 7.

(B) We will prove that one can always find three dwarves who are all pairwise friends.
Consider point \(A\). From it emanate at least \(3\) segments of the same color, since any
two dwarves are either friends or enemies and from one point there are \(5\) outgoing segments
(by the pigeonhole principle). Consider the two possible cases for the colors of the
segments \(AB\), \(AC\), and \(AD\).
- If the segments \(AB\), \(AC\), \(AD\) are red (hate), then the segments \(BC\), \(CD\), \(BD\)
must be green (see Fig. 8) so that the red triangles \(ABC\), \(ACD\), and \(ABD\) do not appear,
because by the given condition there are no three dwarves who all hate each other.
Thus there are three dwarves \(B, C\), and \(D\) who are all friends with each other
(a green triangle \(BCD\) forms).
- The segments \(AB\), \(AC\), \(AD\) are green (friends). Assume the contrary, that there are
no three dwarves who are all pairwise friends (no green triangle). Then the points
\(B, C, D\) must be connected by red segments \(BC\), \(CD\), \(BD\) (see Fig. 9) so that none
of the triangles \(ABC\), \(ACD\), and \(ABD\) is green. But then dwarves \(B, C, D\) all
hate each other, which contradicts the given condition. Therefore the assumption is false,
and there do exist three dwarves who are all pairwise friends.
Atrisinājums
Katru rūķi apzīmēsim ar punktu. Ja divi rūḳi draudzējas, tad
tos savienosim ar zaḷu nogriezni (nepārtraukta līnija), ja
tie viens otru ienīst, tad savienosim tos ar sarkanu nogriezni
(pārtraukta līnija).
(A) Nē, var gadīties, ka nav tādu trīs rūḳu, kas visi savā
starpā draudzējas, piemēram, skat. 7. att.

(B) Pamatosim, ka noteikti var atrast tādus trīs rūķus, kas visi
savā starpā draudzējas.
Apskatām punktu \(A\). No tā iziet vismaz \(3\) vienas krāsas nogriežņi,
jo katri divi rūķi vai nu draudzējas, vai ir ienaidnieki un no viena
punkta iziet \(5\) nogriežņi (pēc Dirihlē principa). Apskatām abus
iespējamos gadījumus, kādā krāsā var būt nogriežņi \(AB\), \(AC\) un \(AD\).
- Ja nogriežņi \(AB\), \(AC\), \(AD\) ir sarkanā krāsā (ienīst), tad nogriežņiem
\(B C, C D, B D\) ir jābūt zaḷā krāsā (skat. 8.att.), lai neveidotos
sarkani trijstūri \(ABC\), \(ACD\) un \(ABD\), jo pēc dotā nav tādu trīs
rūķu, kas visi ienīst viens otru. Tātad ir trīs rūki \(B,C\) un \(D\),
kas visi draudzējas savā starpā (veidojas zals̆ trijstūris \(BCD\)).
- Nogriežņi \(AB\), \(AC\), \(AD\) ir zalạ krāsā (draudzējas). Pieņemsim
pretējo, ka nav tādu trīs rūķu, kas visi savā starpā draudzējas
(nav zaḷa trijstūra). Tad punkti \(B,C,D\) jāsavieno ar sarkaniem
nogriežņiem \(BC\), \(CD\), \(BD\) (skat. 9.att.), lai neviens no trijstūriem
\(ABC\), \(ACD\) un \(ABD\) nebūtu zaļš. Bet tādā gadījumā rūķi \(B,C,D\)
visi viens otru ienīst, kas ir pretrunā ar doto. Tātad pieņēmums ir
aplams un ir tādi trīs rūķi, kas visi savā starpā draudzējas.