In triangle ABC, BC = 12, AC = 13, and AB = sqrt(31). If the altitude is AE and the median is AD, then find DE.