<s>[INST] This problem is part of a series of problems around convolutional neural networks (CNN). Now that we understand CNNs better, let's build a simple math library to gain intuition around how their layers work.
Here is a short code snippet with simple operations related to CNNs, where you will implement a convolution operation. 
Given an input tensor (3 dimensional) of shape (iH, iW, d) and a filter tensor (3 dimensional) of shape (fH, fW, d) where d is the depth of the input and the filter, implement the convolution operation using a sliding window approach. Do not use any libraries like NumPy, TensorFlow, PyTorch, Scikit-image, etc.

### Convolution Operation
The convolution operation should use the following formula to calculate the output at each position (p, q) in the output tensor:
```
out[p][q] = sum[from 0 to d-1] (input[p + k][q + m][depth] * filter[k][m][depth])
```
Here, the input tensor has dimensions iH, iW and the filter tensor has dimensions fH, fW.

Your function should produce the output without any padding.

### Requirements
* Implement a function `convolution` that takes three parameters: 
  - the input tensor `input_data`
  - the filter tensor `filter_data`
  - a boolean flag `debug` which prints intermediate calculations
* The function should return the output tensor of the convolution operation.
* The `convolution` function should handle the cases when the input tensor or the filter tensor is empty.
* The `convolution` function should handle the cases when the dimensions of the input tensor and the filter tensor do not match.

### Constraints
* `input_data` is a list of lists of lists (or equivalent data structure in the chosen programming language), representing the input tensor of shape (iH, iW, d).
* `filter_data` is a list of lists of lists (or equivalent data structure in the chosen programming language), representing the filter tensor of shape (fH, fW, d).
* The input tensor and the filter tensor are both 3-dimensional.

### Function Signature
```python
def convolution(input_data, filter_data, debug=False):
```
Here is a simple example of what the `input_data` and `filter_data` could look like:
```python
input_data = [
    [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
    [[10, 11, 12], [13, 14, 15], [16, 17, 18]],
    [[19, 20, 21], [22, 23, 24], [25, 26, 27]]
]

filter_data = [
    [[1, 2], [3, 4]],
    [[5, 6], [7, 8]]
]
```
And here is an expected output (with `debug=False`):
```python
[[8, 16, 24], [28, 40, 52], [48, 64, 80]]
```
This is the part of the assignment that requires you to implement the convolution operation.

### Optional Questions

1.   How does the depth of the input affect the output of the convolution operation?[/INST]