Pilot contamination due to pilot reuse seriously mitigates the performance of the cell-free massive multiple-input multiple-output (MIMO) systems. In this paper, we propose a joint pilot assignment scheme that employs user clustering and graph coloring (UC-GC) to reduce pilot contamination. The proposed method consists of two steps: firstly, we utilize AP selection to classify all users; secondly, we assign pilots to users with more severe pilot contamination using the graph coloring algorithm and then assign pilots to the remaining users. The numerical simulation results show that the proposed scheme outperforms existing pilot assignment schemes and significantly improves throughout with low complexity.