Graphical Models CMC course, task 1