Perhaps a better way, but:
Using bash and find
while IFS= read -r dir; do
mv -- "$dir" "${dir%/*}/X"
done< <(find . -maxdepth 2 -mindepth 2 -type d)
DO a test run first with something like:
while IFS= read -r dir; do
printf 'mv "%s" "%s"\n' "$dir" "${dir%/*}/X"
done< <(find . -maxdepth 2 -mindepth 2 -type d)
In short:
find
. current directory as base (Typically A in your case)
type d (directory) at minimum and maximum depth of 2
bash read $dir from find and move $dir to
${dir%/*} remove last / and everything there after
/X append the new directory name.
Use for example find ./A ... if you reside one level below A etc.
Optionally add -v to mv (non-POSIX) to show actions taken.