I would like to use two packages which conflict with each others. I hope I can apply them separately whenever I need and then cancel them so as to solve the problem. Is it possible? 

For example, I would like the following works:

```
\documentclass{article}
\usepackage{A}
\begin{document}
ABC
\end{document}

\documentclass{article}
\usepackage{B}
\begin{document}
EFG
\end{document}

```