The Depth of Functions in m-valued Logic