def calc_quarter(y, m):
    """ Calculate previous and next month """
    prev_y = y
    prev_m = m - 1
    next_y = y
    next_m = m + 1
    if m == 1:
        prev_m = 12
        prev_y = y - 1
    elif m == 12:
        next_m = 1
        next_y = y + 1
    return [(prev_y, prev_m), (y, m), (next_y, next_m)]
