Under construction

Still being built. Things may change

RACI Matrix

Interview

Time limit2sMemory limit2048 MB

Summary
Check whether every row of a RACI matrix has exactly one A and at most one R, printing Yes or No.
Level

Easy2 of 10

Topics
Array, Implementation
Solved
No attempts yet

Problem

Nikolai assigned students the task of creating a RACI matrix for a project during a management lecture. A RACI matrix is a responsibility assignment matrix. It lists every stakeholder of the project and their level of involvement in each task. The levels are written as R, A, C, and I. If a stakeholder is not involved in a task, the cell contains -.

  • R (Responsible): performs the task. If nobody holds this level, A performs the whole task.
  • A (Accountable): accepts the task from R. Each task must have exactly one A. The other levels can appear any number of times.
  • C (Consulted): provides consultation while the task is carried out.
  • I (Informed): receives information about the progress of the task.

Write a program that checks whether a given RACI matrix is correct.

Input

The first line contains two integers nn and mm, the number of rows and columns of the matrix (1≤n,m≤1001 \le n, m \le 100).

The next nn lines each contain mm elements separated by spaces. Each row is a task, and each column is a stakeholder. Every element is one of the uppercase letters R, A, C, I, or the minus sign -.

Output

Print Yes if the matrix is correct. Otherwise, print No.

Examples2

  1. Example 1

    Input
    3 5
    C C A - I
    A R - C I
    A R I C -
    
    Expected output
    Yes
    
  2. Example 2

    Input
    3 3
    A - C
    R C I
    - A I
    
    Expected output
    No