Find CFG for : $$L=\left\{ w \in \left\{a,b,c \right\}^* \mid w=a^mb^nc^k \ and \ (n=m \ or \ m\neq k) , m,n,k \in \mathbb{N_{0}}\right\}$$
I tried by dividing in cases:
1) $ w=a^nb^nc^k , k \neq n $
2) $ w=a^mb^nc^k , k \neq n \neq m$
3) $ w=a^nb^nc^n $
The third case is not possible because it is not a context free language? I am having trouble with the first case. I tried by dividing it in cases where $k < n $ and $k >n $, but got stuck because the grammar is supoosed to be similar to the case 3), the difference being in adding c-s.
Hint. Your language is the union of the languages $L_1c^*$, $L_2$ and $L_3$, where \begin{align} L_1 &= \left\{ a^nb^n \mid n \geqslant 0 \right\}, \\ L_2 &= \left\{ a^mb^nc^k \mid m > k \text{ and } m,n,k \geqslant 0 \right\}, \\ L_3 &= \left\{ a^mb^nc^k \mid m < k \text{ and } m,n,k \geqslant 0 \right\} \end{align}