OOoh if so, that is nasty. There is no trick to it I have found, just lots of conditioner and fingers, not combs or brushes, to free the hair. And lots of patience.
One bad one I had that resulted from a week long bought of just could nto get out of bed to function flu took longer than the flu recovery to untangle. I had to cut some out, it was not fun. I got most out, but, it took a long time, and weird looking hair.