This paper considers a connected Markov chain for sampling 3 × 3 ×"K" contingency tables having fixed two-dimensional marginal totals. Such sampling arises in performing various tests of the hypothesis of no three-factor interactions. A Markov chain algorithm is a valuable tool for evaluating "P"-values, especially for sparse datasets where large-sample theory does not work well. To construct a connected Markov chain over high-dimensional contingency tables with fixed marginals, algebraic algorithms have been proposed. These algorithms involve computations in polynomial rings using Gröbner bases. However, algorithms based on Gröbner bases do not incorporate symmetry among variables and are very time-consuming when the contingency tables are large. We construct a minimal basis for a connected Markov chain over 3 × 3 ×"K" contingency tables. The minimal basis is unique. Some numerical examples illustrate the practicality of our algorithms. Copyright 2003 Australian Statistical Publishing Association Inc..