#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int, int> PI;
typedef pair<PI, PI > PII;
const double eps=1e-5;
const LL mod=1e9+7;
const double pi=acos(-1.0);
const int MAXN=201000;
const int MAXM=299900;
const int N=32100;

char s[1005];
int main()
{
    while(~scanf("%s", s))
    {
        int n=strlen(s);
        int h=0;
        for(int i=1;i<n;i+=3)
        {
            if(isalpha(s[i]))
            {
                for(int j=0;j<h;j++)
                    putchar(' ');
                printf("<%c>\n", s[i]);
                h+=2;
            }
            else // </ >
            {
                i++;
                h-=2;
                for(int j=0;j<h;j++)
                    putchar(' ');
                printf("</%c>\n", s[i]);
            }
        }
    }
    return 0;
}


// C_ George and Number [Codeforces Round #227 (Div. 2)]
#include <bits/stdc++.h>

using namespace std;

void printSpaces( int sp ) {
	while ( sp -- )
		cout << " ";
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	// freopen("in.out","w",stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int sp = 0;
	string str;

	cin >> str;

	for ( int i = 0; i < (int)str.size(); i ++ ) {
		if ( !isalpha( str[i] ) ) continue;
		if ( str[i-1] == '<' ) {
			printSpaces( sp );
			cout << "<" << str[i] << ">" << endl;
			sp += 2;
		} else {
			sp -= 2;
			printSpaces( sp );
			cout << "</" << str[i] << ">" << endl;
		}
	}

	return 0;
}


#include <bits/stdc++.h>

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.1415926535897932384626

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

#define INF 99999999

using namespace std;

string t;
char c;
int p, mode, lev;

bool eat(){
	t = "";

	scanf("%c", &c);
	if(c == '\n') return false;
	scanf("%c", &c);
	if(c == '/') mode = 1;
	else{
		mode = 0;
		t += c;
	}
	while(scanf("%c", &c)){
		if(c == '>') break;
		t += c;
	}
	if(mode == 0){
		FI(i, 1, lev * 2) printf(" ");
		cout << '<' << t << '>' << endl;
		lev++;
	}
	else{
		lev--;
		FI(i, 1, lev * 2) printf(" ");
		cout << "</" << t << '>' << endl;
	}
	return true;
}

int main(){
	while(eat());
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
main(){
    string s;
    int count=0;
    string a;
    cin>>s;
    for(int i=0;i<s.length();i++){
//    	cout<<"'"<<count<<"'"<<endl;
        if(s[i+1]=='/'){
        	count--;
            for(int j=0;j<(2*count);j++){
                cout<<' ';
            }
            cout<<s[i]<<s[i+1]<<s[i+2]<<s[i+3]<<endl;
            i=i+3;
        }
        else{
            for(int j=0;j<(2*count);j++){
                cout<<' ';
            }
            cout<<s[i]<<s[i+1]<<s[i+2]<<endl;
            count++;
            i+=2;
        }
    }
}


#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define reps(i,n) for(ll i=1;i<ll(n);i++)
#define rrep(i,n) for(ll i=ll(n);i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=b;i++)//使いにくかったら消す
#define len(x) x.length()//配列の長さ
#define ALL(x) x.begin(),x.end()
#define NPOS string::npos//findで検索失敗した場合の戻り値(findは文字列内に特定の文字列があるかを判定)
typedef long long ll;
using namespace std;
bool comp_len(const std::string &lh,const std::string &rh){return lh.length() < rh.length();}//文字列を長さでソートする時の比較関数
ll ans=0;//解答用の変数
ll gcd(ll a, ll b) {if (b==0) return a;else return gcd(b, a%b);}//最大公約数
ll lcm(ll a, ll b) {return a * b / gcd(a, b);}//最小公倍数
ll digit_sum(ll a,ll b){ll ans=0;while(a>0){ans+=a%b;a/=b;}return ans;}//n進桁和
ll digit_num(ll a,ll b){ll ans=0;while(a>0){ans++;a/=b;}return ans;}//n進桁数
ll fact(ll n){if(n==1)return 1;else return n*fact(n-1);}//階乗
ll array_sum(ll *a,ll n){ll ans=0;rep(i,n){ans+=a[i];}return ans;}//配列総和
ll combi(ll n, ll k){if(n==k||k==0){return 1;}else{return combi(n-1,k-1)+combi(n-1,k);}}//nCkの組み合わせ
bool is_prime(ll x){for(ll i=2;i*i<=x;i++){if(x%i==0)return false;}return true;}//素数判定
// for(long long i=1;i*i<= n;i++){if(n%i==0){ans.push_back(i);if(i*i!=n)ans.push_back(n/i);}}//約数列挙（vector型の変数の用意が必要）

/*Union-Find(素集合データ構造)*/
vector<ll> par(100010);//親の値を保持
ll root(ll x){if(par[x]==x){return x;}else{return par[x]=root(par[x]);}}//根の値を返す
bool same(ll x,ll y){return (root(x)==root(y));}//根が一致しているか判定
void unite(ll x,ll y){x=root(x);y=root(y);if(x==y)return;par[x]=y;}//グループを併合

int main()
{
  string s;
  vector<char> v;
  ll end;
  map<char,int> flag;
  cin>>s;
  rep(i,len(s)){
    if(v.size()>0&&v.back()==s[i])end=v.size();
    if(s[i]>='a'&&s[i]<='z')v.push_back(s[i]);
  }
  ll space=0;

  rep(i,v.size()){
    if(flag[v[i]]==0){
      rep(j,space)cout<<" ";
      cout<<'<'<<v[i]<<'>'<<endl;;
      flag[v[i]]=1;
      space+=2;
    }else{
      rep(j,space-2)cout<<" ";
      cout<<'<'<<'/'<<v[i]<<'>'<<endl;
      flag[v[i]]=0;
      space-=2;
    }
  }

  /*
  rep(i,end){
  rep(j,space)cout<<" ";
  cout<<'<'<<v[i]<<'>'<<endl;;
  space+=2;
}
space-=2;
for(ll i=end;i<v.size();i++){
rep(j,space)cout<<" ";
cout<<'<'<<'/'<<v[i]<<'>'<<endl;
space-=2;
}
*/
return 0;
}


#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define reps(i,n) for(ll i=1;i<ll(n);i++)
#define rrep(i,n) for(ll i=ll(n);i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=b;i++)//使いにくかったら消す
#define len(x) x.length()//配列の長さ
#define ALL(x) x.begin(),x.end()
#define NPOS string::npos//findで検索失敗した場合の戻り値(findは文字列内に特定の文字列があるかを判定)
typedef long long ll;
using namespace std;
bool comp_len(const std::string &lh,const std::string &rh){return lh.length() < rh.length();}//文字列を長さでソートする時の比較関数
ll ans=0;//解答用の変数
ll gcd(ll a, ll b) {if (b==0) return a;else return gcd(b, a%b);}//最大公約数
ll lcm(ll a, ll b) {return a * b / gcd(a, b);}//最小公倍数
ll digit_sum(ll a,ll b){ll ans=0;while(a>0){ans+=a%b;a/=b;}return ans;}//n進桁和
ll digit_num(ll a,ll b){ll ans=0;while(a>0){ans++;a/=b;}return ans;}//n進桁数
ll fact(ll n){if(n==1)return 1;else return n*fact(n-1);}//階乗
ll array_sum(ll *a,ll n){ll ans=0;rep(i,n){ans+=a[i];}return ans;}//配列総和
ll combi(ll n, ll k){if(n==k||k==0){return 1;}else{return combi(n-1,k-1)+combi(n-1,k);}}//nCkの組み合わせ
bool is_prime(ll x){for(ll i=2;i*i<=x;i++){if(x%i==0)return false;}return true;}//素数判定
// for(long long i=1;i*i<= n;i++){if(n%i==0){ans.push_back(i);if(i*i!=n)ans.push_back(n/i);}}//約数列挙（vector型の変数の用意が必要）

/*Union-Find(素集合データ構造)*/
vector<ll> par(100010);//親の値を保持
ll root(ll x){if(par[x]==x){return x;}else{return par[x]=root(par[x]);}}//根の値を返す
bool same(ll x,ll y){return (root(x)==root(y));}//根が一致しているか判定
void unite(ll x,ll y){x=root(x);y=root(y);if(x==y)return;par[x]=y;}//グループを併合

int main()
{
  string s;
  vector<char> v;
  vector<bool> is_end;
  ll end;
  // map<char,int> flag;
  cin>>s;
  rep(i,len(s)){
    if(v.size()>0&&v.back()==s[i])end=v.size();
    if(s[i]>='a'&&s[i]<='z'){
      v.push_back(s[i]);
      if(s[i-1]=='<')is_end.push_back(false);
      else is_end.push_back(true);
    }
  }
  ll space=0;

  rep(i,v.size()){
    if(is_end[i]==false){
      rep(j,space)cout<<" ";
      cout<<'<'<<v[i]<<'>'<<endl;;
      space+=2;
    }else{
      rep(j,space-2)cout<<" ";
      cout<<'<'<<'/'<<v[i]<<'>'<<endl;
      space-=2;
    }
  }

  return 0;
}


#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cstdlib>
#include <cmath>

// using
using namespace std;

// typedef
typedef vector<int> VI;
typedef vector<VI> VII;
typedef vector<string> VS;
typedef vector<long> VL;
typedef long long LL;
typedef vector<LL> VLL;

// container utils
#define PB push_back
#define PF push_front
#define GRT(x) greater<(x)>()
#define ASORT(x) sort((x).begin(), (x).end())
#define DSORT(x, y) sort((x).begin(), (x).end(), greater<(y)>())
#define FILL(x, y) fill((x).begin(), (x).end(), (y))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORL(i, a, b) for (long i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REPL(i, n) FORL(i, 0, n)

// debug
#define DUMP(a) cerr << #a << " = " << (a) << endl
#define DUMP2(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << endl
#define DUMP3(a, b, c) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << ", " << #c << " = " << (c) << endl

string str;

void solve() {
  cin >> str;
  int h = 0;

  int i = 0;
  while (i < str.size()) {
    if (str[i] == '<' && str[i+2] == '>') {
      REP(j, h) cout << " ";
      cout << str.substr(i, 3) << endl;
      h += 2;
      i += 3;
      continue;
    }
    if (str[i] == '<' && str[i+3] == '>') {
      h -= 2;
      REP(j, h) cout << " ";
      cout << str.substr(i, 4) << endl;
      i += 4;
    }
  }

}

int main(int argc, char *argv[]) {
  solve();

  return 0;
}


#include <iostream>
#include <cstring>

#include <string>
#include <vector>
#include <algorithm>

#include <cassert>
#include <cctype>

using namespace std;

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

int pos;
string line;
string next_tag(bool peek = false) {
   if (pos >= SZ(line)) return "";
   size_t q = line.find('>', pos);
   if (q == string::npos) return "";
   string res(line, pos, q-pos+1);
   if (!peek)
      pos = q + 1;
   return res;
}

void go(int level = 0) {
   while (true) {
      string tag = next_tag(true);
      if (tag.empty() || tag[1] == '/')
         break;
      next_tag();

      cout << string(level*2, ' ') << tag << '\n';
      char c = tag[1];

      go(level+1);

      tag = next_tag();
      assert(!tag.empty() && tag[1] == '/' && tag[2] == c);

      cout << string(level*2, ' ') << tag << '\n';
   }
}

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);

   cin >> line;

   go();

   return 0;
}
//hellobig_tq//hello


#include <iostream>
#include <vector>

struct ctoken{
  enum etype{
    OPEN,
    CLOSE
  }type;
  char c;
  ctoken(enum etype type,char c):type(type),c(c){
  }
};

std::vector<struct ctoken> tokens;

void lex(){
  std::string str;
  std::cin>>str;
  for(int i=0;i<str.length();i++){
    if(str[i]=='<'){
      if(str[i+1]=='/'){
	tokens.push_back(ctoken(ctoken::CLOSE,str[i+2]));
      }else{
	tokens.push_back(ctoken(ctoken::OPEN,str[i+1]));
      }
    }
  }
}

int main(){
  lex();
  int indent=0;
  for(int i=0;i<tokens.size();i++){
    switch(tokens[i].type){
    case ctoken::OPEN:
      std::cout<<std::string(indent,' ');
      std::cout<<"<"<<tokens[i].c<<">"<<std::endl;
      indent+=2;
      break;
    case ctoken::CLOSE:
      indent-=2;
      std::cout<<std::string(indent,' ');
      std::cout<<"</"<<tokens[i].c<<">"<<std::endl;
      break;
    }
  }
  return 0;
}


/*************************************
 * problem:      CF125B Simple XML.
 * user ID:      63720.
 * user name:    航空信奥.
 * time:         2019-04-11.
 * language:     C++.
 * upload place: Luogu.
*************************************/

#include <bits/stdc++.h>
using namespace std;

template <typename Int>
inline Int read()
{
    Int flag = 1;
    char c = getchar();
    while ((!isdigit(c)) && c != '-') c = getchar();
    if (c == '-') flag = -1, c = getchar();
    Int init = c & 15;
    while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
	return init * flag;
}

template <typename Int>
inline void write(Int x)
{
    if (x < 0) putchar('-'), x = ~x + 1;
    if (x > 9) write(x / 10);
    putchar((x % 10) | 48);
}

template <typename Int>
inline void write(Int x, char nextch)
{
    write(x);
    putchar(nextch);
}

enum XMLflagType {
    XMLstart = 1, XMLend = 2
};

struct flag {
    string name;
    XMLflagType type;
} a[400];
int n = 0, pos = 1;

void printTab(int len)
{
    for (int i = 1; i <= len; i++) {
        putchar(' ');
        putchar(' ');
    }
}

void dfs(int h)
{
    while (a[pos].type == XMLstart) {
        printTab(h);
        printf("<%s>\n", a[pos].name.c_str());
        pos++;
        dfs(h + 1);
        printTab(h);
        printf("</%s>\n", a[pos].name.c_str());
        pos++;
        if (pos > n) return;
    }
}

int main()
{
    char str[503];
    while (scanf("<%[^>]>", str) != EOF) {
        n++;
        if (str[0] == '/') {
            a[n].type = XMLend;
            a[n].name = str + 1;
        } else {
            a[n].type = XMLstart;
            a[n].name = str;
        }
    }
    // printf("function 'read' is ok.\n");
    dfs(0);
}
/*
intput1

<c></c>
output1

    <c>
    </c>

input2

<d><c></c></d>
output2

  <d>
    <c>
    </c>
  </d>

*/


/*************************************
 * problem:      CF125B Simple XML.
 * user ID:      63720.
 * user name:    航空信奥.
 * time:         2019-04-11.
 * language:     C++.
 * upload place: Luogu.
*************************************/

#include <bits/stdc++.h>
using namespace std;

template <typename Int>
inline Int read()
{
    Int flag = 1;
    char c = getchar();
    while ((!isdigit(c)) && c != '-') c = getchar();
    if (c == '-') flag = -1, c = getchar();
    Int init = c & 15;
    while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
	return init * flag;
}

template <typename Int>
inline void write(Int x)
{
    if (x < 0) putchar('-'), x = ~x + 1;
    if (x > 9) write(x / 10);
    putchar((x % 10) | 48);
}

template <typename Int>
inline void write(Int x, char nextch)
{
    write(x);
    putchar(nextch);
}

enum XMLflagType {
    XMLstart = 1, XMLend = 2
};

struct flag {
    string name;
    XMLflagType type;
} a[400];
int n = 0, pos = 1;

void printTab(int len)
{
    for (int i = 1; i <= len; i++) {
        putchar(' ');
        putchar(' ');
    }
}

void dfs(int h)
{
    while (a[pos].type == XMLstart) {
        printTab(h);
        printf("<%s>\n", a[pos].name.c_str());
        pos++;
        dfs(h + 1);
        printTab(h);
        printf("</%s>\n", a[pos].name.c_str());
        pos++;
        if (pos > n) return;
    }
}

int main()
{
    char str[503];
    while (getchar() == '<') {
        scanf("%[^>]>", str);
        n++;
        if (str[0] == '/') {
            a[n].type = XMLend;
            a[n].name = str + 1;
        } else {
            a[n].type = XMLstart;
            a[n].name = str;
        }
    }
    // printf("function 'read' is ok.\n");
    dfs(0);
}
/*
intput1

<c></c>
output1

    <c>
    </c>

input2

<d><c></c></d>
output2

  <d>
    <c>
    </c>
  </d>

*/


/*************************************
 * problem:      CF125B Simple XML.
 * user ID:      63720.
 * user name:    航空信奥.
 * time:         2019-04-11.
 * language:     C++.
 * upload place: Luogu.
*************************************/

#include <bits/stdc++.h>
using namespace std;

template <typename Int>
inline Int read()
{
    Int flag = 1;
    char c = getchar();
    while ((!isdigit(c)) && c != '-') c = getchar();
    if (c == '-') flag = -1, c = getchar();
    Int init = c & 15;
    while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
	return init * flag;
}

template <typename Int>
inline void write(Int x)
{
    if (x < 0) putchar('-'), x = ~x + 1;
    if (x > 9) write(x / 10);
    putchar((x % 10) | 48);
}

template <typename Int>
inline void write(Int x, char nextch)
{
    write(x);
    putchar(nextch);
}

enum XMLflagType {
    start = 1, end = 2
};

struct flag {
    string name;
    XMLflagType type;
} a[400];
int n = 0, pos = 1;

void printTab(int len)
{
    for (int i = 1; i <= len; i++) {
        putchar(' ');
        putchar(' ');
    }
}

void dfs(int h)
{
    while (a[pos].type == start) {
        printTab(h);
        printf("<%s>\n", a[pos].name.c_str());
        pos++;
        dfs(h + 1);
        printTab(h);
        printf("</%s>\n", a[pos].name.c_str());
        pos++;
        if (pos > n) return;
    }
}

int main()
{
    char str[503];
    while (scanf("<%[^>]>", str) != EOF) {
        n++;
        if (str[0] == '/') {
            a[n].type = end;
            a[n].name = str + 1;
        } else {
            a[n].type = start;
            a[n].name = str;
        }
    }
    // printf("function 'read' is ok.\n");
    dfs(0);
}
/*
intput1

<c></c>
output1

    <c>
    </c>

input2

<d><c></c></d>
output2

  <d>
    <c>
    </c>
  </d>

*/


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int cr = -1;
    string s;
    cin >> s;
    for(int i = 0 ; i + 2< s.size() ; i += 3){
        if(s[i + 1] == '/'){
            for(int l = 0; l < 2 * cr ;l ++)
                cout <<" ";
            cout << s.substr(i , 4) << "\n";
            i ++, cr -- ;
        }
        else{
            cr ++;
            for(int l = 0 ;l < 2 * cr ;l ++)
                cout << " ";
            cout << s.substr(i , 3) << "\n";
        }
    }
}


#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
using namespace std;

string a;
int cir;

int main() {
	cin >> a;
	for(int i = 0; i < a.size(); (a[i + 1] == '/') ? i += 4 : i += 3) {
		for(int j = 1; j <= cir; ++j)
			printf("  ");
		for(int j = 0; j < ((a[i + 1] == '/') ? 4 : 3); ++j) {
			printf("%c",  a[i + j]);
		}
		puts("");
		if(a[i + 1] != '/' && a[i + 4] != '/')	cir++;
		else if(a[i + 1] == '/' && a[i + 5] == '/') cir--;
	}
}


#include <bits/stdc++.h>
using namespace std;
#define LOG(x) cout << #x << " := " << x << endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
typedef pair<int,int> par;
typedef long long ll;
int n;
string s;
void rec(int l, int r, int h) {
    if (l >= r) return;
    while (l < r) {
        char c = s[l + 1];
        int cnt = 1;
        int j = l + 2;
        while (cnt) {
            if (s[j] == c) ++cnt;
            if (s[j] == '/') {
                if (s[++j] == c) --cnt;
            }
            ++j;
        }
        cout << setw(2 * h + 1) << "<" << c << ">\n";
        rec(l + 3, j - 4, h + 1);
        cout << setw(2 * h + 2) << "</" << c << ">\n";
        l = j + 1;
    }
}
int main(void) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> s;
    int n = s.size();
    rec(0, n, 0);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
 #ifndef ONLINE_JUDGE
  freopen("in.in", "r", stdin);
  //freopen("output.txt", "w", stdout);
    #endif
   string s;
   cin>>s;
   int c = 2;
   for(int i = 0;i < s.size();++i)
   {
      if(s[i] == '>')
      {
         cout<<s[i]<<endl;
         if(s[i+1] == '<' && s[i+2] == '/'){
           if(i != s.size()-5)
            c /= 2;
          else c = 0;
         for(int j = 0;j < c;++j)
          cout<<' ';
         }
        else
        {
          for(int j = 0;j < c;++j)
             cout<<' ';
            c*=2;
        }
      }
      else
        cout<<s[i];
   }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
 #ifndef ONLINE_JUDGE
  freopen("in.in", "r", stdin);
  //freopen("output.txt", "w", stdout);
    #endif
   string s;
   cin>>s;
   int c = 2;
   for(int i = 0;i < s.size();++i)
   {
      if(s[i] == '>')
      {
         cout<<s[i]<<endl;
         if(s[i+1] == '<' && s[i+2] == '/'){
            c -= 2;
         for(int j = 0;j < c;++j)
          cout<<' ';
         }
        else
        {
          for(int j = 0;j < c;++j)
             cout<<' ';
            c+=2;
        }
      }
      else
        cout<<s[i];
   }
}


/*
 * File:   main.cpp
 * Author: Moath
 *
 * Created on July 23, 2016, 9:30 PM
 */

#include <cstdlib>
#include<bits/stdc++.h>
using namespace std;

/*
 *
 */
int main(int argc, char** argv) {

    string s;
    cin>>s;
    stack<char> st;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]>='a' && s[i]<='z')
        {
            if(s[i-1]=='/')
            {
                for(int j=0;j<st.size() - 1;j++)
                {
                    cout<<"  ";
                }
                cout<<"</"<<s[i]<<">"<<endl;
                st.pop();
            }
            else
            {
                for(int j=0;j<st.size();j++)
                {
                    cout<<"  ";
                }
                cout<<"<"<<s[i]<<">"<<endl;
                st.push(s[i]);
            }
        }
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <stack>
#include <cstring>
#include <math.h>
#include<cstdio>
#include<deque>
#include<sstream>
using namespace std;
#define mp make_pair
#define eps 1e-6
int dx[] = { 0, 0, 1, -1, 1, 1, -1, -1 };
int dy[] = { 1, -1, 0, 0, 1, -1, 1, -1 };
map<string, int> m;
int main() {
	//freopen("a.txt", "rt", stdin);
	//freopen("output.txt", "w", stdout);
	string s;
	cin >> s;
	string tmp = "";
	int n = s.length();
	vector<string> v;
	for (int i = 0; i < s.length(); i++) {

		tmp += s[i];

		if (s[i] == '>') {
			v.push_back(tmp);
			tmp = "";
		}

	}
	cout << v[0] << endl;
	int len = 1;
	for (int i = 1; i < v.size(); i++) {
		tmp = v[i];
		if (tmp[0] == '<' && tmp[1] == '/') {
			for (int j = 0; j < len; j++)
				printf(" ");
			len /= 2;
		} else {
			len *= 2;
			for (int j = 0; j < len; j++)
				printf(" ");
		}

		cout << v[i] << endl;
		;
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <stack>
#include <cstring>
#include <math.h>
#include<cstdio>
#include<deque>
#include<sstream>
using namespace std;
#define mp make_pair
#define eps 1e-6
int dx[] = { 0, 0, 1, -1, 1, 1, -1, -1 };
int dy[] = { 1, -1, 0, 0, 1, -1, 1, -1 };
map<string, int> m;
int main() {
    //freopen("a.txt", "rt", stdin);
    //freopen("output.txt", "w", stdout);
    string s;
    cin >> s;
    string tmp = "";
    int n = s.length();
    vector<string> v;
    for (int i = 0; i < s.length(); i++) {

        tmp += s[i];

        if (s[i] == '>') {
            v.push_back(tmp);
            tmp = "";
        }

    }

    int len = 0;
    int cnt = 0;
    for (int i = 0; i < v.size(); i++) {
        tmp = v[i];
        if (tmp[0] == '<' && tmp[1] == '/') {
            if (cnt != 1) {
                for (int j = 0; j < len; j++)
                    printf(" ");
                len -= 2;
            }
            cnt--;
        } else {
            if (cnt != 0) {
                len += 2;
                for (int j = 0; j < len; j++)
                    printf(" ");
            }
            cnt++;
        }

        cout << v[i] << endl;

    }

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <stack>
#include <cstring>
#include <math.h>
#include<cstdio>
#include<deque>
#include<sstream>
using namespace std;
#define mp make_pair
#define eps 1e-6
int dx[] = { 0, 0, 1, -1, 1, 1, -1, -1 };
int dy[] = { 1, -1, 0, 0, 1, -1, 1, -1 };
map<string, int> m;
int main() {
    //freopen("a.txt", "rt", stdin);
    //freopen("output.txt", "w", stdout);
    string s;
    cin >> s;
    string tmp = "";
    int n = s.length();
    vector<string> v;
    for (int i = 0; i < s.length(); i++) {

        tmp += s[i];

        if (s[i] == '>') {
            v.push_back(tmp);
            tmp = "";
        }

    }

    int len = 1;
    int cnt = 0;
    for (int i = 0; i < v.size(); i++) {
        tmp = v[i];
        if (tmp[0] == '<' && tmp[1] == '/') {
            if (cnt != 1)
                for (int j = 0; j < len; j++)
                    printf(" ");
            len /= 2;
            if (len == 0)
                len = 1;
            cnt--;
        } else {

            if (cnt != 0) {
                len *= 2;
                for (int j = 0; j < len; j++)
                    printf(" ");
            }
            cnt++;
        }

        cout << v[i] << endl;

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
char s[1020];
int main(){
	scanf("%s",s);
	int cnt=0;
	for(int i=0;i<strlen(s);i++){
		if(s[i]=='<'||s[i]=='>')continue;
		if(s[i]=='/'){
			cnt--;
			for(int j=0;j<cnt*2;j++)
				printf(" ");
			printf("</%c>\n",s[i+1]);
			i++;
		}
		else{
			for(int j=0;j<cnt*2;j++)
				printf(" ");
			printf("<%c>\n",s[i]);
			cnt++;
		}
	}
	return 0;
}


#include<iostream>
#include<string.h>
using namespace std;

int main(){
	char string[10001];

	cin>>string;

	int tags=0;
	int n = strlen(string);
	int i=0;
	while(string[i]!='\0'){
		if(i+1<n && string[i+1]==47){
			tags--;
			for(int space=0;space<2*tags;space++){
				cout<<" ";
			}
			cout<<string[i]<<string[i+1]<<string[i+2]<<string[i+3]<<endl;
			i=i+4;
		}else{
			for(int space=0;space<2*tags;space++){
				cout<<" ";
			}
			cout<<string[i]<<string[i+1]<<string[i+2]<<endl;
			tags++;
			i=i+3;
		}
	}
}


///██╗ ██████╗ ██╗    ██████╗  ██████╗  ██████╗   ██████╗
///██║██╔═══██╗██║    ╚════██╗██╔═████╗ ╚════██╗ ██╔═████╗
///██║██║   ██║██║     █████╔╝██║██╔██║  █████╔╝ ██║██╔██║
///██║██║   ██║██║    ██╔═══╝ ████╔╝██║ ██╔═══╝  ████╔╝██║
///██║╚██████╔╝██║    ███████╗╚██████╔╝ ███████╗ ╚██████╔╝
///╚═╝ ╚═════╝ ╚═╝    ╚══════╝ ╚═════╝  ╚══════╝  ╚═════╝

#include<bits/stdc++.h>
#include<fstream>
///#include "windows.h"
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define mlojins cout.tie(NULL);
#define bzbz cin.tie(NULL);
#define CODER ios_base::sync_with_stdio(0)  ;
#define p_b pop_back
#define p_f pop_front
#define Qulukh
#define quluq return 0;
#define Zohiri_dzd
#define Mekh
#define Black_star
#define Amo_2151
using namespace std ;

    const ll N = 4e3 + 0.000001 ;

int main ()
{
    Qulukh
    bzbz
    mlojins
    Mekh
    CODER
    Zohiri_dzd
    Black_star
    Amo_2151
    ///freopen("input.txt" , "r" , stdin );
    ///freopen("output.txt", "w" , stdout );
    ///Author of the greatest code :: Murtazoev Alijon
    ///4294967295
    string XML ;
    cin >> XML ;
    ll cnt = 0 ;
    deque < string > v ;
    for (ll i = 0 ; i < XML.size() ; i ++ )
    {
        ll point ;
        point = i + 1 ;
        string send ;
        while (XML[point] != '>')
            send += XML[point] , point ++ ;
        if (send[0] == '/')
            send.erase(send.begin()) ;
        v.pb(send) ;
        i = point ;
    }
    map < string , ll > mp ;
    for (ll i = 0 ; i < v.size() ; i ++ )
    {
        mp[v[i]] ++ ;
        if (mp[v[i]] == 1)
        {
            for (ll j = 0 ; j < cnt ; j ++ )
                cout << " " ;
            cout << "<" ;
            cout << v[i] ;
            cout << ">" ;
            cout << endl ;
            cnt += 2 ;
        }
        else
        {
            cnt -= 2 ;
            for (ll j = 0 ; j < cnt ; j ++ )
                cout << " " ;
            cout << "</" ;
            cout << v[i] ;
            cout << ">" ;
            cout << endl ;
            mp[v[i]] = 0;
        }
    }
}
///Mavl studios
///Eco students
///8 is the best


///██╗ ██████╗ ██╗    ██████╗  ██████╗  ██████╗   ██████╗
///██║██╔═══██╗██║    ╚════██╗██╔═████╗ ╚════██╗ ██╔═████╗
///██║██║   ██║██║     █████╔╝██║██╔██║  █████╔╝ ██║██╔██║
///██║██║   ██║██║    ██╔═══╝ ████╔╝██║ ██╔═══╝  ████╔╝██║
///██║╚██████╔╝██║    ███████╗╚██████╔╝ ███████╗ ╚██████╔╝
///╚═╝ ╚═════╝ ╚═╝    ╚══════╝ ╚═════╝  ╚══════╝  ╚═════╝

#include<bits/stdc++.h>
#include<fstream>
///#include "windows.h"
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define mlojins cout.tie(NULL);
#define bzbz cin.tie(NULL);
#define CODER ios_base::sync_with_stdio(0)  ;
#define p_b pop_back
#define p_f pop_front
#define Qulukh
#define quluq return 0;
#define Zohiri_dzd
#define Mekh
#define Black_star
#define Amo_2151
using namespace std ;

    const ll N = 4e3 + 0.000001 ;

int main ()
{
    Qulukh
    bzbz
    mlojins
    Mekh
    CODER
    Zohiri_dzd
    Black_star
    Amo_2151
    ///freopen("input.txt" , "r" , stdin );
    ///freopen("output.txt", "w" , stdout );
    ///Author of the greatest code :: Murtazoev Alijon
    ///4294967295
    string XML ;
    cin >> XML ;
    ll cnt = 0 ;
    deque < string > v ;
    for (ll i = 0 ; i < XML.size() ; i ++ )
    {
        ll point ;
        point = i + 1 ;
        string send ;
        while (XML[point] != '>')
            send += XML[point] , point ++ ;
        if (send[0] == '/')
            send.erase(send.begin()) ;
        v.pb(send) ;
        i = point ;
    }
    map < string , ll > mp ;
    for (ll i = 0 ; i < v.size() ; i ++ )
    {
        mp[v[i]] ++ ;
        if (mp[v[i]] == 1)
        {
            for (ll j = 0 ; j < cnt ; j ++ )
                cout << " " ;
            cout << "<" ;
            cout << v[i] ;
            cout << ">" ;
            cout << endl ;
            cnt += 2 ;
        }
        else
        {
            cnt -= 2 ;
            for (ll j = 0 ; j < cnt ; j ++ )
                cout << " " ;
            cout << "</" ;
            cout << v[i] ;
            cout << ">" ;
            cout << endl ;
        }
    }
}
///Mavl studios
///Eco students
///8 is the best


///██╗ ██████╗ ██╗    ██████╗  ██████╗  ██████╗   ██████╗
///██║██╔═══██╗██║    ╚════██╗██╔═████╗ ╚════██╗ ██╔═████╗
///██║██║   ██║██║     █████╔╝██║██╔██║  █████╔╝ ██║██╔██║
///██║██║   ██║██║    ██╔═══╝ ████╔╝██║ ██╔═══╝  ████╔╝██║
///██║╚██████╔╝██║    ███████╗╚██████╔╝ ███████╗ ╚██████╔╝
///╚═╝ ╚═════╝ ╚═╝    ╚══════╝ ╚═════╝  ╚══════╝  ╚═════╝

#include<bits/stdc++.h>
#include<fstream>
///#include "windows.h"
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define mlojins cout.tie(NULL);
#define bzbz cin.tie(NULL);
#define CODER ios_base::sync_with_stdio(0)  ;
#define p_b pop_back
#define p_f pop_front
#define Qulukh
#define quluq return 0;
#define Zohiri_dzd
#define Mekh
#define Black_star
#define Amo_2151
using namespace std ;

    const ll N = 4e3 + 0.000001 ;

int main ()
{
    Qulukh
    bzbz
    mlojins
    Mekh
    CODER
    Zohiri_dzd
    Black_star
    Amo_2151
    ///freopen("input.txt" , "r" , stdin );
    ///freopen("output.txt", "w" , stdout );
    ///Author of the greatest code :: Murtazoev Alijon
    ///4294967295
    string XML ;
    cin >> XML ;
    ll cnt = 0 ;
    for (ll i = 0 ; i < XML.size() ; i ++ )
    {
        ll p = i + 1;
        if (XML[p] == '/')
        {
            cnt -= 2 ;
            ll ans = cnt ;
            while (ans -- )
                cout << " " ;
            cout << XML[p - 1] << XML[p] << XML[p + 1] << XML[p + 2] ;
            cout << endl ;
            i = p + 2 ;
        }
        else
        {
            ll ans = cnt ;
            while (ans -- )
                cout << " " ;
            cout << "<" << XML[p] << ">" ;
            cout << endl ;
            cnt += 2 ;
            i = p + 1 ;
        }
    }
}
///Mavl studios
///Eco students
///8 is the best


#include<bits/stdc++.h>
using namespace std;

void space(int n)
{
    for(int i = 1; i <= 2 * n; i++)
        printf(" ");
}

int main ()
{
    string s;
    cin >> s;
    int h = 0;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i + 1] == '/')
        {
            h --;
            space(h);
            cout << s.substr(i, 4) << endl;
            i += 3;
        }
        else
        {
            space(h);
            cout << s.substr(i, 3) << endl;
            h ++;
            i += 2;
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int st=0;
	vector <string> v;
	for(int i=0;i<s.size();i++){
		if(s[i]=='>'){
			if(s[st+1]=='/'){
				v.pop_back();
				for(int j=0;j<v.size();j++) cout<<"  ";
				cout<<s.substr(st,i-st+1)<<endl;
			}
			else{
				for(int j=0;j<v.size();j++) cout<<"  ";
				cout<<s.substr(st,i-st+1)<<endl;
				v.push_back(s.substr(st,i-st));
			}
		}
		if(s[i]=='<'){
			st=i;
		}
	}
}


#include<bits/stdc++.h>

#define LL long long
#define Dl double
#define Pb push_back
#define Po pop_back
#define Mp make_pair
#define In insert

using namespace std;

typedef vector<LL> Vl;
typedef pair<LL, LL> Pll;
typedef vector<Pll> Vpl;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
#define X first
#define Y second

int main()
{
    string s;
    cin >> s;

    LL L = s.size();

    for(LL i = 0; i < L; i++){
        if(s[i] == '<' || s[i] == '>')
            s[i] = '.';
    }

    for(LL i = 1; i < L; i++){
        if(s[i] >= 'a' && s[i] <= 'z' && s[i - 1] == '/')
            s[i - 1] = '.', s[i] -= 32;
    }

    string str;
    for(LL i = 0; i < L; i++)
        if((s[i] >= 'a' && s[i] <= 'z')
           || (s[i] >= 'A' && s[i] <= 'Z'))
            str.Pb(s[i]);

    LL h = -1;
    L = str.size();

    for(LL i = 0; i < L; i++){
        if(str[i] >= 'a' && str[i] <= 'z'){
            h++;
            for(LL j = 0; j < 2 * h; j++)
                cout << ' ';
            cout << '<';
            cout << str[i];
            cout << '>';
        }
        else{
            for(LL j = 0; j < 2 * h; j++)
                cout << ' ';
            cout << "</";
            cout << (char)(str[i] + 32);
            cout << ">";

            h--;
        }
        cout << '\n';
    }
    return 0;
}


#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <cstdio>
#include <deque>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>

using namespace std;

#define f first
#define s second

#define mp make_pair
#define pb push_back
#define ppb pop_back
const int N = 1e6 + 123;
int g[4 * 1005];
char ch;
long long cnt = 1, max2;
int b[123], c[123];
queue <char> q;
int main() {
	string s;
	int sum = 0, sa = 0, sb = 0, sc = 0, cnt = 0, ans = 0;
	cin >> s;
	string a = "", b = "";
	for (int i = 0; i < s.size() - 2; i++) {
		if (s[i] == '<' && s[i + 1] >= 'a' && s[i + 1] <= 'z')                        {
			q.push(s[i + 1]);
		for (int j = 0; j < q.size() * 2 - 2; j++)
			cout << ' ';
			cout << s.substr(i, 3) << endl;
		}
		else if (s[i] == '<' && s[i + 1] == '/' && s[i + 2] >= 'a' && s[i + 2] <= 'z') {
		for (int j = 0; j < q.size() * 2 - 2; j++)
			cout << ' ';
			q.pop();
			cout << s.substr(i, 4) << endl;
		}
		if (q.size() == 0)
			break;

	}
	cout << b << ' ' << a;
	return 0;
}


#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <cstdio>
#include <deque>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>

using namespace std;

#define f first
#define s second

#define mp make_pair
#define pb push_back
#define ppb pop_back
const int N = 1e6 + 123;
int g[4 * 1005];
char ch;
long long cnt = 1, max2;
int b[123], c[123];
queue <char> q;
int main() {
	string s;
	int sum = 0, sa = 0, sb = 0, sc = 0, cnt = 0, ans = 0;
	cin >> s;
	string a = "", b = "";
	for (int i = 0; i < s.size() - 2; i++) {
		if (s[i] == '<' && s[i + 1] >= 'a' && s[i + 1] <= 'z')                        {
			q.push(s[i + 1]);
		for (int j = 0; j < q.size() * 2 - 2; j++)
			cout << ' ';
			cout << s.substr(i, 3) << endl;
		}
		else if (s[i] == '<' && s[i + 1] == '/' && s[i + 2] >= 'a' && s[i + 2] <= 'z') {
		for (int j = 0; j < q.size() * 2 - 2; j++)
			cout << ' ';
			q.pop();
			cout << s.substr(i, 4) << endl;
		}

	}
	cout << b << ' ' << a;
	return 0;
}


#include <bits/stdc++.h>

#define INF 2000000000000000000
#define INF 0x3f3f3f3f
#define PI 3.14159265359
#define ll long long

#define NMax 500002
#define DIM 8192

#define f cin
#define g cout

using namespace std;
//
//ifstream f("d.in");
//ofstream g("d.out");

string x;
stack<char> s;
int p;

int main()
{
    f >> x;
    p = 0;
    for(int i = 0; i < x.size(); i += 3){
        if(x[i + 1]  == '/'){
            --p;
            for(int j = 0; j < p * 2; ++j)
                g << ' ';
            g<<"</" << (char)(x[i + 2]) << ">\n";
            s.pop();
            ++i;
        }else{
            for(int j = 0; j < p * 2; ++j)
                g << ' ';
            g<<"<" << (char)(x[i+ 1] ) << ">\n";
            s.push('a');
            p ++;
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>

#include <string>
#include <vector>
#include <algorithm>

#include <cassert>
#include <cctype>

using namespace std;

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

int pos;
string line;
string next_tag(bool peek = false) {
   if (pos >= SZ(line)) return "";
   size_t q = line.find('>', pos);
   if (q == string::npos) return "";
   string res(line, pos, q-pos+1);
   if (!peek)
      pos = q + 1;
   return res;
}

void go(int level = 0) {
   while (true) {
      string tag = next_tag(true);
      if (tag.empty() || tag[1] == '/')
         break;
      next_tag();

      cout << string(level*2, ' ') << tag << '\n';
      char c = tag[1];

      go(level+1);

      tag = next_tag();
      assert(!tag.empty() && tag[1] == '/' && tag[2] == c);

      cout << string(level*2, ' ') << tag << '\n';
   }
}

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);

   cin >> line;

   go();

   return 0;
}
//hellobig_tq


#include <bits/stdc++.h>
using namespace std;

int  l, h, cur_level=0;
string s, x;

int main()
{
   //freopen("r.txt","r",stdin);
   cin>>s;
   l=s.size();
   for(int i=0;i<l;i++){
        x=s[i], x+=s[i+1], x+=s[i+2];
        if(s[i+2]!='>')
            x+=s[i+3], i++;
        i+=2;
        for(int j=0;j<cur_level-(x.size()==4);j++)
            cout<<"  ";
         cout<<x<<"\n";
        if(x.size()==4)
            h=x[2]-'a', cur_level--;
        else
            h=x[1]-'a', cur_level++;
   }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int level[1005], l, h, cur_level;
string s, x;

int main()
{
   //freopen("r.txt","r",stdin);
   cin>>s;
   l=s.size();
   for(int i=0;i<l;i++){
        x=s[i], x+=s[i+1], x+=s[i+2];
        if(s[i+2]!='>')
            x+=s[i+3], i++;
        i+=2;
        if(x.size()==4)
            h=x[2]-'a', cur_level--;
        else
            h=x[1]-'a', level[h]=cur_level, cur_level++;
        for(int j=0;j<level[h];j++)
            cout<<"  ";
        cout<<x<<"\n";
   }

    return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
string s;
int i,j,sum;
int main(){
	cin>>s;
	for(i=0;i<s.length();(s[i+1]=='/')?i+=4:i+=3){
		for(j=1;j<=sum;j++)
			cout<<" ";
		for(j=0;j<((s[i+1]=='/')?4:3);j++)
			cout<<s[i+j];
		puts("");
		if(s[i+1]!='/'&&s[i+4]!='/')sum++;
		else if(s[i+1]=='/'&&s[i+5]=='/')sum--;
	}
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
string s;
int i,j,sum;
int main(){
	cin>>s;
	for(i=0;i<s.length();(s[i+1]=='/')?i+=4:i+=3){
		for(j=1;j<=sum;j++)
			cout<<" ";
		for(j=0;j<((s[i+1]=='/')?4:3);j++)
			cout<<s[i+j];
		cout<<endl;
		if(s[i+1]!='/'&&s[i+4]!='/')sum+=2;
		else if(s[i+1]=='/'&&s[i+5]=='/')sum-=2;
	}
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
string s;
int i,j,sum;
int main(){
	cin>>s;
	for(i=0;i<s.length();(s[i+1]=='/')?i+=4:i+=3){
		for(j=1;j<=sum;j++)
			cout<<" ";
		for(j=0;j<((s[i+1]=='/')?4:3);j++)
			cout<<s[i+j];
		cout<<endl;
		if(s[i+1]!='/'&&s[i+4]!='/')sum++;
		else if(s[i+1]=='/'&&s[i+5]=='/')sum--;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define  sci(x)   scanf("%d", &x)
#define  scl(x)   scanf("%lld", &x)
#define  scd(x)   scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)

int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	//CODE TONOY
	int h;
	string s;
	cin >> s;
    int len = (int)s.length();
    for (int i=0 ; i<len ; i++)
	{
	if(s[i]=='<')
		{
		if(s[i+1]=='/')
		h--;
		for(int j=0 ; j<2*h ; j++)
		putchar(' ');
		if(s[i+1]!='/')
		h++;
		}
		putchar(s[i]);
		if(s[i]=='>')
		putchar('\n');
	}
	return 0;
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.BufferedOutputStream;
import java.util.StringTokenizer;
import java.io.Closeable;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.Flushable;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	static class TaskAdapter implements Runnable {
		@Override
		public void run() {
			InputStream inputStream = System.in;
			OutputStream outputStream = System.out;
			Input in = new Input(inputStream);
			Output out = new Output(outputStream);
			CHobbitsParty solver = new CHobbitsParty();
			solver.solve(1, in, out);
			out.close();
		}
	}

	public static void main(String[] args) throws Exception {
		Thread thread = new Thread(null, new TaskAdapter(), "", 1<<29);
		thread.start();
		thread.join();
	}
	static class CHobbitsParty {
		public CHobbitsParty() {
		}

		public void solve(int testNumber, Input in, Output pw) {
			int n = in.nextInt(), i;
			for(i = 2; (i*(i-1) >> 1)<=n; i++) ;
			i--;
			pw.println(i);
			ArrayList<Integer>[] lists = new ArrayList[i];
			for(int j = 0; j<i; j++) {
				lists[j] = new ArrayList<>();
			}
			int ind = 1;
			for(int k = 0; k<i; k++) {
				for(int j = k+1; j<i; j++) {
					lists[k].add(ind);
					lists[j].add(ind++);
				}
			}
			for(int j = 0; j<i; j++) {
				pw.println(lists[j]);
			}
		}

	}

	static class Output implements Closeable, Flushable {
		public StringBuilder sb;
		public OutputStream os;
		public int BUFFER_SIZE;
		public boolean autoFlush;
		public String LineSeparator;

		public Output(OutputStream os) {
			this(os, 1<<16);
		}

		public Output(OutputStream os, int bs) {
			BUFFER_SIZE = bs;
			sb = new StringBuilder(BUFFER_SIZE);
			this.os = new BufferedOutputStream(os, 1<<17);
			autoFlush = false;
			LineSeparator = System.lineSeparator();
		}

		public void print(Object... o) {
			for(int i = 0; i<o.length; i++) {
				if(i!=0) {
					print(" ");
				}
				print(String.valueOf(o[i]));
			}
		}

		public void print(String s) {
			sb.append(s);
			if(autoFlush||sb.length()>BUFFER_SIZE >> 1) {
				flush();
			}
		}

		public void println(int i) {
			println(String.valueOf(i));
		}

		public void println(String s) {
			sb.append(s);
			println();
			if(autoFlush||sb.length()>BUFFER_SIZE >> 1) {
				flush();
			}
		}

		public void println() {
			sb.append(LineSeparator);
		}

		public <T> void println(Iterable<T> iter) {
			boolean first = true;
			for(T t: iter) {
				if(!first) {
					print(" ");
				}
				first = false;
				print(t);
			}
			println();
		}

		public void flush() {
			try {
				os.write(sb.toString().getBytes());
			}catch(IOException e) {
				e.printStackTrace();
			}
			sb = new StringBuilder(BUFFER_SIZE);
		}

		public void close() {
			flush();
			try {
				os.close();
			}catch(IOException e) {
				e.printStackTrace();
			}
		}

	}

	static class Input {
		BufferedReader br;
		StringTokenizer st;

		public Input(InputStream is) {
			this(is, 1<<20);
		}

		public Input(InputStream is, int bs) {
			br = new BufferedReader(new InputStreamReader(is), bs);
			st = null;
		}

		public boolean hasNext() {
			try {
				while(st==null||!st.hasMoreTokens()) {
					String s = br.readLine();
					if(s==null) {
						return false;
					}
					st = new StringTokenizer(s);
				}
				return true;
			}catch(Exception e) {
				return false;
			}
		}

		public String next() {
			if(!hasNext()) {
				throw new InputMismatchException();
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStreamReader;
import java.io.BufferedOutputStream;
import java.util.StringTokenizer;
import java.io.Closeable;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.Flushable;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	static class TaskAdapter implements Runnable {
		@Override
		public void run() {
			InputStream inputStream = System.in;
			OutputStream outputStream = System.out;
			Input in = new Input(inputStream);
			Output out = new Output(outputStream);
			CHobbitsParty solver = new CHobbitsParty();
			solver.solve(1, in, out);
			out.close();
		}
	}

	public static void main(String[] args) throws Exception {
		Thread thread = new Thread(null, new TaskAdapter(), "", 1<<29);
		thread.start();
		thread.join();
	}
	static class CHobbitsParty {
		public CHobbitsParty() {
		}

		public void solve(int testNumber, Input in, Output pw) {
			int n = in.nextInt(), i;
			for(i = 2; (i*(i-1) >> 1)<=n; i++) ;
			i--;
			pw.println(i);
			for(int k = 1; k<=i; k++) {
				for(int j = k+1; j<=i; j++) {
					pw.println(k, j);
				}
			}
		}

	}

	static class Output implements Closeable, Flushable {
		public StringBuilder sb;
		public OutputStream os;
		public int BUFFER_SIZE;
		public boolean autoFlush;
		public String LineSeparator;

		public Output(OutputStream os) {
			this(os, 1<<16);
		}

		public Output(OutputStream os, int bs) {
			BUFFER_SIZE = bs;
			sb = new StringBuilder(BUFFER_SIZE);
			this.os = new BufferedOutputStream(os, 1<<17);
			autoFlush = false;
			LineSeparator = System.lineSeparator();
		}

		public void print(String s) {
			sb.append(s);
			if(autoFlush||sb.length()>BUFFER_SIZE >> 1) {
				flush();
			}
		}

		public void println(int i) {
			println(String.valueOf(i));
		}

		public void println(Object... o) {
			for(int i = 0; i<o.length; i++) {
				if(i!=0) {
					print(" ");
				}
				print(String.valueOf(o[i]));
			}
			println();
		}

		public void println(String s) {
			sb.append(s);
			println();
			if(autoFlush||sb.length()>BUFFER_SIZE >> 1) {
				flush();
			}
		}

		public void println() {
			sb.append(LineSeparator);
		}

		public void flush() {
			try {
				os.write(sb.toString().getBytes());
			}catch(IOException e) {
				e.printStackTrace();
			}
			sb = new StringBuilder(BUFFER_SIZE);
		}

		public void close() {
			flush();
			try {
				os.close();
			}catch(IOException e) {
				e.printStackTrace();
			}
		}

	}

	static class Input {
		BufferedReader br;
		StringTokenizer st;

		public Input(InputStream is) {
			this(is, 1<<20);
		}

		public Input(InputStream is, int bs) {
			br = new BufferedReader(new InputStreamReader(is), bs);
			st = null;
		}

		public boolean hasNext() {
			try {
				while(st==null||!st.hasMoreTokens()) {
					String s = br.readLine();
					if(s==null) {
						return false;
					}
					st = new StringTokenizer(s);
				}
				return true;
			}catch(Exception e) {
				return false;
			}
		}

		public String next() {
			if(!hasNext()) {
				throw new InputMismatchException();
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}


#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<string>
#include<string.h>
#include<fstream>
#include<stack>
#include<iomanip>
#include<bitset>
#include<cmath>
#include<locale>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
#define lson rt<<1
#define rson rt<<1|1
#define mid (l+r)>>1
#define mes(a) memset(a,0,sizeof a)
//#define int long long
long double pi = acos(-1);
const LL mod = 1e9 + 9;
LL QPow(LL a, LL b) {LL ans = 1; while (b) { if (b & 1)ans = ans*a%mod; a = a * a%mod; b >>= 1; }return ans;}
/*bool vis[200002];
int prim[200002];
int top;
void init()
{
	vis[0] = vis[1] = 1;
	for (int i = 2; i <= 200000; i++)
	{
		if (!vis[i])prim[top++] = i;
		for (int j = 0; j < top&&prim[j] * i <= 200000; j++)
		{
			vis[prim[j] * i] = 1;
			if (i%prim[j] == 0)
				break;
		}
	}
}*/
LL toInt(string str)
{
	LL ans = 0;
	for (int i = 0; i < str.size(); i++)
	{
		ans *= 10;
		ans += str[i] - '0';
	}
	return ans;
}
string toString(LL a)
{
	if (a == 0)return "0";
	string temp = "";
	LL tp = a;
	while (tp)
	{
		temp.push_back('0' + tp % 10);
		tp /= 10;
	}
	string temp2 = temp;
	for (int ii = 0; ii < temp.size(); ii++)
	{
		temp[ii] = temp2[temp.size() - 1 - ii];
	}
	return temp;
}
//const LL mod = 1e9 + 7;
const int MAXN = 1;
const int INF = 0x3f3f3f3f;
double eps = 1e-8;
int b[4][4];
int ans[4][4];
int md[4][4];
inline LL add(const LL&a, const LL&b)
{
	return (a + b) >= mod ? (a + b) - mod : (a + b < 0 ? (a + b) + mod : a + b);
}
inline LL mul(const LL&a, const LL&b)
{
	return 1LL * a*b%mod;
}
void matrixpow(int n)
{
	while (n)
	{
		if (n & 1)
		{
			for(int i=0;i<4;i++)
				for (int j = 0; j < 4; j++)
				{
					md[i][j] = 0;
					for (int k = 0; k < 4; k++)
						md[i][j] = add(md[i][j], mul(ans[i][k], b[k][j]));
				}
			memcpy(ans, md, sizeof ans);
		}
		for (int i = 0; i < 4; i++)
			for (int j = 0; j < 4; j++)
			{
				md[i][j] = 0;
				for (int k = 0; k < 4; k++)
					md[i][j] = add(md[i][j], mul(b[i][k], b[k][j]));
			}
		memcpy(b, md, sizeof b);
		n >>= 1;
	}
}

signed main()
{
	ifstream in("Text.txt");
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t, n;
	cin >> n;
	cout << 3 << endl;
	cout << "1 2\n1 3\n2 3\n";
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<string>
#include<string.h>
#include<fstream>
#include<stack>
#include<iomanip>
#include<bitset>
#include<cmath>
#include<locale>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
#define lson rt<<1
#define rson rt<<1|1
#define mid (l+r)>>1
#define mes(a) memset(a,0,sizeof a)
//#define int long long
long double pi = acos(-1);
const LL mod = 1e9 + 9;
LL QPow(LL a, LL b) {LL ans = 1; while (b) { if (b & 1)ans = ans*a%mod; a = a * a%mod; b >>= 1; }return ans;}
/*bool vis[200002];
int prim[200002];
int top;
void init()
{
	vis[0] = vis[1] = 1;
	for (int i = 2; i <= 200000; i++)
	{
		if (!vis[i])prim[top++] = i;
		for (int j = 0; j < top&&prim[j] * i <= 200000; j++)
		{
			vis[prim[j] * i] = 1;
			if (i%prim[j] == 0)
				break;
		}
	}
}*/
LL toInt(string str)
{
	LL ans = 0;
	for (int i = 0; i < str.size(); i++)
	{
		ans *= 10;
		ans += str[i] - '0';
	}
	return ans;
}
string toString(LL a)
{
	if (a == 0)return "0";
	string temp = "";
	LL tp = a;
	while (tp)
	{
		temp.push_back('0' + tp % 10);
		tp /= 10;
	}
	string temp2 = temp;
	for (int ii = 0; ii < temp.size(); ii++)
	{
		temp[ii] = temp2[temp.size() - 1 - ii];
	}
	return temp;
}
//const LL mod = 1e9 + 7;
const int MAXN = 1;
const int INF = 0x3f3f3f3f;
double eps = 1e-8;
int b[4][4];
int ans[4][4];
int md[4][4];
inline LL add(const LL&a, const LL&b)
{
	return (a + b) >= mod ? (a + b) - mod : (a + b < 0 ? (a + b) + mod : a + b);
}
inline LL mul(const LL&a, const LL&b)
{
	return 1LL * a*b%mod;
}
void matrixpow(int n)
{
	while (n)
	{
		if (n & 1)
		{
			for(int i=0;i<4;i++)
				for (int j = 0; j < 4; j++)
				{
					md[i][j] = 0;
					for (int k = 0; k < 4; k++)
						md[i][j] = add(md[i][j], mul(ans[i][k], b[k][j]));
				}
			memcpy(ans, md, sizeof ans);
		}
		for (int i = 0; i < 4; i++)
			for (int j = 0; j < 4; j++)
			{
				md[i][j] = 0;
				for (int k = 0; k < 4; k++)
					md[i][j] = add(md[i][j], mul(b[i][k], b[k][j]));
			}
		memcpy(b, md, sizeof b);
		n >>= 1;
	}
}
int p[100002];
int mi[100002];
char aa[100002];
int val[100002];
int as[100002];
int ans3[220][220];
signed main()
{
	ifstream in("Text.txt");
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t, n;
	int m;
	//freopen("Text.txt", "r", stdin);
	cin >> m;
	n = 1;
	while ((n + 1)*n / 2 <= m)
	{
		n++;
	}
	n--;
	cout << n + 1 << endl;
	int cnt = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = i; j <= n; j++)
			ans3[i][j] = cnt++;
	}
	for (int i = 2; i <= n+1; i++)
	{
		for (int j = 1; j < i; j++)
		{
			ans3[i][j] = ans3[j][i - 1];
		}
	}
	for (int i = 1; i <= n + 1; i++)
	{
		for (int j = 1; j <= n; j++)
			cout << ans3[i][j] << " ";
		cout << endl;
	}
//	system("pause");
	return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <string>
#include <iomanip>
#include <list>

typedef long long ll;

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;

	int res = 2;
	while (res * (res + 1) <= 2 * n)
	{
		++res;
	}

	vector<vector<int> > result(res, vector<int>(res - 1));
	int elf = 1;
	for (int i = 0; i < res - 1; ++i)
	{
		for (int j = i; j < res - 1; ++j)
		{
			result[i][j] = elf;
			result[j + 1][i] = elf;
			++elf;
		}
	}

	cout << res << endl;
	for (int i = 0; i < res; ++i)
	{
		for (int j = 0; j < res - 1; ++j)
		{
			cout << result[i][j] << " ";
		}
		cout << endl;
	}
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstring>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <cstdio>
#define turbo ios::sync_with_stdio(false)
#define ll long long
#define inf 1000000000000000;
using namespace std;
ll a, b, c, d, n, m, k, q;

int main(){
    turbo;
    cin>>n;
    if(n==3){cout<<1<<" "<<2<<endl<<1<<" "<<3<<endl<<2<<" "<<3<<endl; return 0;}
    int arr[2003][2003];
    memset(arr, 0, sizeof(arr));
    arr[1][1]=1;
    arr[1][2]=2;
    arr[2][1]=1;
    arr[2][2]=3;
    arr[3][1]=2;
    arr[3][2]=3;
    a=4;
    m=n;
    for(int i=4; ; i++){
        if(2*i-2>n){d=i; break;}
        for(int x=1; x<i; x++){
            arr[x][i-1]=a;
            arr[i][x]=a;
            a++;
        }
        m-=i;

    }
    cout<<d-1<<endl;
    for(int i=1; i<=n; i++){
        if(arr[i][1]==0)break;
        for(int x=1; ; x++){
            if(arr[i][x]==0)break;
            cout<<arr[i][x]<<" ";
        }
        cout<<endl;
    }

}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstring>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <cstdio>
#define turbo ios::sync_with_stdio(false)
#define ll long long
#define inf 1000000000000000;
using namespace std;
ll a, b, c, d, n, m, k, q;

int main(){
    turbo;
    cin>>n;
    if(n==3){cout<<1<<" "<<2<<endl<<1<<" "<<3<<endl<<2<<" "<<3<<endl; return 0;}
    int arr[203][203];
    memset(arr, 0, sizeof(arr));
    arr[1][1]=1;
    arr[1][2]=2;
    arr[2][1]=1;
    arr[2][2]=3;
    arr[3][1]=2;
    arr[3][2]=3;
    a=4;
    m=n-3;
    for(int i=4; ; i++){
        if(m<i){d=i; break;}
        for(int x=1; x<i; x++){
            arr[x][i-1]=a;
            arr[i][x]=a;
            a++;
        }
        m-=i;

    }
    cout<<d-1<<endl;
    for(int i=1; i<=n; i++){
        if(arr[i][1]==0)break;
        for(int x=1; ; x++){
            if(arr[i][x]==0)break;
            cout<<arr[i][x]<<" ";
        }
        cout<<endl;
    }

}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstring>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <cstdio>
#define turbo ios::sync_with_stdio(false)
#define ll long long
#define inf 1000000000000000;
using namespace std;
ll a, b, c, d, n, m, k, q;

int main(){
    turbo;
    cin>>n;
    if(n==3){cout<<3<<endl<<1<<" "<<2<<endl<<1<<" "<<3<<endl<<2<<" "<<3<<endl; return 0;}
    int arr[203][203];
    memset(arr, 0, sizeof(arr));
    arr[1][1]=1;
    arr[1][2]=2;
    arr[2][1]=1;
    arr[2][2]=3;
    arr[3][1]=2;
    arr[3][2]=3;
    a=4;
    b=3;
    for(int i=4; ; i++){
        if(i+b-1>n){d=i; break;}
        for(int x=1; x<i; x++){
            arr[x][i-1]=a;
            arr[i][x]=a;
            a++;
        }
       b=b+i-1;

    }
    cout<<d-1<<endl;
    for(int i=1; i<=n; i++){
        if(arr[i][1]==0)break;
        for(int x=1; ; x++){
            if(arr[i][x]==0)break;
            cout<<arr[i][x]<<" ";
        }
        cout<<endl;
    }

}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstring>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <cstdio>
#define turbo ios::sync_with_stdio(false)
#define ll long long
#define inf 1000000000000000;
using namespace std;
ll a, b, c, d, n, m, k, q;

int main(){
    turbo;
    cin>>n;
    if(n==3){cout<<1<<" "<<2<<endl<<1<<" "<<3<<endl<<2<<" "<<3<<endl; return 0;}
    int arr[2003][2003];
    memset(arr, 0, sizeof(arr));
    arr[1][1]=1;
    arr[1][2]=2;
    arr[2][1]=2;
    arr[2][2]=3;
    arr[3][1]=3;
    arr[3][2]=2;
    a=4;
    m=n-3;
    for(int i=4; ; i++){
        if(m<i){d=i; break;}
        for(int x=1; x<i; x++){
            arr[x][i-1]=a;
            arr[i][x]=a;
            a++;
        }
        m-=i;

    }
    cout<<d-1<<endl;
    for(int i=1; i<=n; i++){
        if(arr[i][1]==0)break;
        for(int x=1; ; x++){
            if(arr[i][x]==0)break;
            cout<<arr[i][x]<<" ";
        }
        cout<<endl;
    }

}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstring>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <cstdio>
#define turbo ios::sync_with_stdio(false)
#define ll long long
#define inf 1000000000000000;
using namespace std;
ll a, b, c, d, n, m, k, q;

int main(){
    turbo;
    cin>>n;
    if(n==3){cout<<1<<" "<<2<<endl<<1<<" "<<3<<endl<<2<<" "<<3<<endl; return 0;}
    int arr[203][203];
    memset(arr, 0, sizeof(arr));
    arr[1][1]=1;
    arr[1][2]=2;
    arr[2][1]=1;
    arr[2][2]=3;
    arr[3][1]=2;
    arr[3][2]=3;
    a=4;
    b=3;
    for(int i=4; ; i++){
        if(i+b-1>n){d=i; break;}
        for(int x=1; x<i; x++){
            arr[x][i-1]=a;
            arr[i][x]=a;
            a++;
        }
       b=b+i-1;

    }
    cout<<d-1<<endl;
    for(int i=1; i<=n; i++){
        if(arr[i][1]==0)break;
        for(int x=1; ; x++){
            if(arr[i][x]==0)break;
            cout<<arr[i][x]<<" ";
        }
        cout<<endl;
    }

}


#include<bits/stdc++.h>
#include <iomanip>
#define ll long long int
#define ld long double
#define IOS cin.tie(NULL);cout.tie(NULL)
#define f first
#define inf 100000000000000000
#define ii pair<ll,ll>
#define vi vector<ll>
#define vii vector<ii>
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define sc(i) scanf("%lld",&i);
#define s second
#define pb push_back
#define forn(i,n) for(int i=0;i<(int)n;i++)
using namespace std;
ll const mod=1000000007;
ll arr1[1000009];
set<ll> sieve;
void sievefun(ll n){
    for(ll i=2;i<=n;i++){
        if(arr1[i]==0){
            for(ll j=i*i;j<=n;j+=i){
                arr1[j]=1;
            }
        }
    }
    for(int i=2;i<=n;i++){
    	if(arr1[i]==0)sieve.insert(i);
    }
}
ll power(ll x, ll y) {
	ll temp;
	if( y == 0)
		return 1;
	temp = power(x, y/2);
	if (y%2 == 0)
		return ((temp)*(temp));
	else
		return (((x))*((temp*temp)));
}

int main()
{	//sievefun(1000000);
	// cout << fixed << setprecision
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

	ll n;
	cin>>n;
	ll temp=1;
	while(((temp)*(temp-1))/2<=n)temp++;
	temp--;
	vi g[temp+3];
	ll ind=1;
	cout<<temp<<endl;
	for(int i=1;i<=temp;i++){
		for(int j=i+1;j<=temp;j++){
			g[i].pb(ind);g[j].pb(ind);
			ind++;
		}
	}
	for(int i=1;i<=temp;i++){
		for(auto j:g[i]){
			cout<<j<<" ";
		}
		cout<<endl;
	}
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
#include <bitset>
#include <cctype>
typedef long long ll;
#define MAX 1005
using namespace std;
int n,m;
ll k;
#define INF 2147483647
#define inf 1<<30
#define MOD 1000000007
#define EPS 1e-8
#define G 9.8
#define PI acos(-1)
bool debug = false;

int main()
{
    cin>>n;
    for(m=110; m*(m-1)>2*n;m--);
    printf("%d\n", m);
    int nn = m*(m-1)/2;
    vector<int> ans[m];
    for(int i=1,p=0,q=1;i<=nn;i++) {
        ans[p].push_back(i); ans[q].push_back(i);
        q++;
        if (q>=m) {p++; q=p+1;}
    }
    for(int i=0;i<m;i++) {
        for(auto x: ans[i]) printf("%d ", x);
        puts("");
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
#include <bitset>
#include <cctype>
typedef long long ll;
#define MAX 1005
using namespace std;
int n,m;
ll k;
#define INF 2147483647
#define inf 1<<30
#define MOD 1000000007
#define EPS 1e-8
#define G 9.8
#define PI acos(-1)
bool debug = false;

int main()
{
    cin>>n;
    for(m=110; m*(m-1)>2*n;m--);
    printf("%d\n", m);
    for(int i=0;i<m;i++) {
        for(int j=0;j<m-1;j++) {
            printf("%d ", (i+j)%m + 1);
        }
        puts("");
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
#include <bitset>
#include <cctype>
typedef long long ll;
#define MAX 1005
using namespace std;
int n,m;
ll k;
#define INF 2147483647
#define inf 1<<30
#define MOD 1000000007
#define EPS 1e-8
#define G 9.8
#define PI acos(-1)
bool debug = false;

int main()
{
    cin>>n;
    for(m=210; m*(m-1)>2*n;m--);
    printf("%d\n", m);
    int nn = m*(m-1)/2;
    vector<int> ans[m];
    for(int i=1,p=0,q=1;i<=nn;i++) {
        ans[p].push_back(i); ans[q].push_back(i);
        q++;
        if (q>=m) {p++; q=p+1;}
    }
    for(int i=0;i<m;i++) {
        for(auto x: ans[i]) printf("%d ", x);
        puts("");
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define OP ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> pii;
const int inf = int(1e9);
const int mod = inf + 7;
const double PI = acos(-1.0);
using namespace std;
const int N = 1e5 + 155;
template<typename T>
inline void read(T&x){
    x=0;int f=1;char ch = getchar();
    while(ch<'0' ||ch>'9'){ if(ch=='-')f=-1;ch=getchar(); }
    while(ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
    x*=f;
}
vector <vector <int> > get(int s) {
    int last = 1;
    vector <vector <int> > v;
    for (int i = 1; i <= s + 1; ++i) {
        vector <int> t;
        for (int j = 0; j < i - 1; ++j)
            t.push_back(v[j][i - 2]);
        for (int j = i; j <= s; ++j)
            t.push_back(last++);
        v.push_back(t);
    }
    return v;
}

void solve(){
    int n;
    cin >> n;
    int s = 1;
    for (s = 1; ; ++s) {
        if (1ll * s * (s + 1) / 2 > n)
            break;
    }
    --s;
    vector<vector<int> > v = get(s);

    printf("%d\n", (int)v.size());

    for (auto i : v) {
        for (auto j : i)
            printf("%d ", j);
        printf("\n");
    }
}

int main(){
    //OP
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    while(t--)
    solve();
    return 0;
}


//In The Name of Allah
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template < class T > using Tree = tree < T , null_type , less < T > , rb_tree_tag , tree_order_statistics_node_update >;

typedef long long            ll;
typedef long double          ld;
typedef string               str;
typedef pair < ll , ll >     pll;

#define X               first
#define Y               second
#define pb              push_back
#define all(x)			(x).begin(), (x).end()
#define SZ(x) 			(ll)(x.size())
#define sep             ' '
#define fast_io         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define dbl_io(x)       cout << fixed << setprecision(x);

const int N = 1e3 + 10;
const ll mod = 1e9 + 7;
const ll inf = 1e18 + 10;

vector < ll > vec[N];

int main(){
    fast_io
    //dbl_io(10);
    ll n;
    cin >> n;
    ll ans = 1;
    while (ans * (ans - 1) / 2 <= n)
    	ans ++;
    ans --;
    ll now = 1;
    for (ll i = 1; i <= ans; i ++)
    	for (ll j = i + 1; j <= ans; j ++)
    		vec[i].push_back(now), vec[j].push_back(now ++);
    cout << ans << '\n';
    for (ll i = 1; i <= ans; i ++, cout << '\n')
    	for (ll x : vec[i])
    		cout << x << ' ';
    return 0;
}


#include<bits/stdc++.h>
#include<iostream>
typedef long long LL;
using namespace std;

int main()
{
     int n;
    cin>>n;
      int m = 1;
    while(m*(m-1) <= 2*n)
        m++;
    m = m-1;
    cout<<m<<'\n';
    int arr[m+4][m+3];
    LL k = 1;
    for(int i = 0;i< m;i++)
    {
        LL count = 0;
        for(int j = i;j < m-1;j++)
        {
           arr[i][j] = k + count++;
        }
        count = 0;
        for(LL j = i+1;j<m ;j++)
        {
            arr[j][i] = k + count++;
        }
        k = k + m - i - 1;
    }
    for(LL i = 0;i < m;i++)
    {
        for(LL j = 0;j<m-1;j++)
        {
            cout<<arr[i][j]<<" ";
        }
        cout<<'\n';
    }
}


#include<bits/stdc++.h>
#include<iostream>
typedef long long LL;
using namespace std;

int main()
{
     int n;
    cin>>n;
      int m = 1;
    while(m*(m-1) <= 2*n)
        m++;
    m = m-1;
    n = (m*(m-1))/2;
    cout<<m<<'\n';
    int arr[m-1][m];
    int k = 1;
    for(int i = 0;i< m;i++)
    {
        int count = 0;
        for(int j = i;j < m-1;j++)
        {
           arr[i][j] = k + count++;
        }
        count = 0;
        for(int j = i+1;j<m ;j++)
        {
            arr[j][i] = k + count++;
        }
        k = k + m - i - 1;
    }
    for(int i = 0;i < m;i++)
    {
        for(int j = 0;j<m-1;j++)
        {
            cout<<arr[i][j]<<" ";
        }
        cout<<'\n';
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
bool d=false;
ll dp[2000000]={0};
map<pair<ll,ll>,ll> mp;
void dfs(vector<ll> arr[],ll st,bool v[])
{
    v[st]=true;
    for(auto it=arr[st].begin();it!=arr[st].end();++it)
    {
        if(!v[*it])
        {   dp[*it]=dp[st]+1;
             if(dp[*it]%2==1)
             {mp.insert(make_pair(make_pair(st,*it),1));
             mp.insert(make_pair(make_pair(*it,st),0));}
             else
             {mp.insert(make_pair(make_pair(st,*it),0));
             mp.insert(make_pair(make_pair(*it,st),1));}
             dfs(arr,*it,v);
        }
        else
        {   if(dp[*it]%2==1)
             {mp.insert(make_pair(make_pair(st,*it),1));
             mp.insert(make_pair(make_pair(*it,st),0));}
             else
             {mp.insert(make_pair(make_pair(st,*it),0));
             mp.insert(make_pair(make_pair(*it,st),1));}
            if((dp[st]+dp[*it])%2==0)
                d=true;
        }
    }
}
int main()
{
    ll n,m;
    cin>>n>>m;
    vector<ll> arr[n];
    ll a,b;
    pair<ll,ll> w[n];
    for(int x=0;x<m;x++)
    {
        cin>>a>>b;
        w[x]=make_pair(a-1,b-1);
        arr[a-1].push_back(b-1);
        arr[b-1].push_back(a-1);
    }
    bool v[n];
    memset(v,false,sizeof(v));
    dfs(arr,0,v);
    if(!d)
    {  cout<<"YES"<<endl;
        for(int x=0;x<m;x++)
    {
        cout<<mp[make_pair(w[x].first,w[x].second)];
    }
    }
    else
        cout<<"NO";
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
bool d=false;
ll dp[200005]={0};
pair<int,int> w[200005];
vector<int> arr[200005];
map<pair<ll,ll>,ll> mp;
void dfs(vector<int> arr[],ll st,bool v[])
{
    v[st]=true;
    for(auto it=arr[st].begin();it!=arr[st].end();++it)
    {
        if(!v[*it])
        {   dp[*it]=dp[st]+1;
             if(dp[*it]%2==1)
             {mp[make_pair(st,*it)]=1;
             mp[make_pair(*it,st)]=0;}
             else
             {mp[make_pair(st,*it)]=0;
              mp[make_pair(*it,st)]=1;}
             dfs(arr,*it,v);
        }
        else
        {   if(!mp.count(make_pair(st,*it)))
            {if(dp[*it]%2==1)
             {mp[make_pair(st,*it)]=1;
             mp[make_pair(*it,st)]=0;}
             else
             {mp[make_pair(st,*it)]=0;
             mp[make_pair(*it,st)]=1;}
             }
            if((dp[st]+dp[*it])%2==0)
                d=true;
        }
    }
}
int main()
{
    ll n,m;
    cin>>n>>m;
    ll a,b;
    for(ll x=0;x<m;x++)
    {
        cin>>a>>b;
        w[x]=make_pair(a-1,b-1);
        arr[a-1].push_back(b-1);
        arr[b-1].push_back(a-1);
    }
    bool v[n];
    memset(v,false,sizeof(v));
    dfs(arr,0,v);
    if(!d)
    {  cout<<"YES"<<endl;
        for(int x=0;x<m;x++)
    {
        cout<<mp[make_pair(w[x].first,w[x].second)];
    }
    }
    else
        cout<<"NO";
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
bool d=false;
ll dp[1000000]={0};
map<pair<ll,ll>,ll> mp;
void dfs(vector<ll> arr[],ll st,bool v[])
{
    v[st]=true;
    for(auto it=arr[st].begin();it!=arr[st].end();++it)
    {
        if(!v[*it])
        {   dp[*it]=dp[st]+1;
             if(dp[*it]%2==1)
             {mp.insert(make_pair(make_pair(st,*it),1));
             mp.insert(make_pair(make_pair(*it,st),0));}
             else
             {mp.insert(make_pair(make_pair(st,*it),0));
             mp.insert(make_pair(make_pair(*it,st),1));}
             dfs(arr,*it,v);
        }
        else
        {
            if((dp[st]+dp[*it])%2==0)
                d=true;
        }
    }
}
int main()
{
    ll n,m;
    cin>>n>>m;
    vector<ll> arr[n];
    ll a,b;
    pair<ll,ll> w[n];
    for(int x=0;x<m;x++)
    {
        cin>>a>>b;
        w[x]=make_pair(a-1,b-1);
        arr[a-1].push_back(b-1);
        arr[b-1].push_back(a-1);
    }
    bool v[n];
    memset(v,false,sizeof(v));
    dfs(arr,0,v);
    if(!d)
    {  cout<<"YES"<<endl;
        for(int x=0;x<m;x++)
    {
        cout<<mp[make_pair(w[x].first,w[x].second)];
    }
    }
    else
        cout<<"NO";
}


#include<bits/stdc++.h>
using namespace std;
bool d=false;
int dp[1000000]={0};
map<pair<int,int>,int> mp;
void dfs(vector<int> arr[],int st,bool v[])
{
    v[st]=true;
    for(auto it=arr[st].begin();it!=arr[st].end();++it)
    {
        if(!v[*it])
        {   dp[*it]=dp[st]+1;
             if(dp[*it]%2==1)
             {mp.insert(make_pair(make_pair(st,*it),1));
             mp.insert(make_pair(make_pair(*it,st),1));}
             else
             {mp.insert(make_pair(make_pair(st,*it),0));
             mp.insert(make_pair(make_pair(*it,st),0));}
             dfs(arr,*it,v);
        }
        else
        {
            if((dp[st]+dp[*it])%2==0)
                d=true;
        }
    }
}
int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> arr[n];
    int a,b;
    pair<int,int> w[n];
    for(int x=0;x<m;x++)
    {
        cin>>a>>b;
        w[x]=make_pair(a-1,b-1);
        arr[a-1].push_back(b-1);
        arr[b-1].push_back(a-1);
    }
    bool v[n];
    memset(v,false,sizeof(v));
    dfs(arr,0,v);
    if(!d)
    {  cout<<"YES"<<endl;
        for(int x=0;x<m;x++)
    {
        cout<<mp[make_pair(w[x].first,w[x].second)];
    }
    }
    else
        cout<<"NO";
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define endl '\n'
ll getsum(string n) {
	ll ans = 0;
	for (ll i = 0; i < n.length(); i++) {
		ans += n[i] - '0';
	}
	return ans;
}
ll power(ll x, ll y, ll mod) {
	ll res = 1;
	x = x % mod;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}
ll power(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
string CONVERT_TO_BINARY(ll s) {
	string res = "";
	while (s != 0) {
		res += (char)('0' + s % 2);
		s /= 2;
	}
	reverse(res.begin() , res.end());
	return res;
}
bool PALIN(string s) {
	ll i = 0;
	ll j = s.length() - 1;
	while (i <= j) {
		if (s[i] != s[j]) return false;
		j-- , i++;
	}
	return true;
}
ll modInverse(ll a, ll m) {
	return power(a, m - 2);
}
ll findLongestSub(string bin) {
	ll n = bin.length(), i;
	ll sum = 0;
	unordered_map<ll, ll> prevSum;
	ll maxlen = 0;
	ll currlen;
	for (i = 0; i < n; i++) {
		if (bin[i] == '1')
			sum++;
		else sum--;
		if (sum > 0) {
			maxlen = i + 1;
		}
		else if (sum <= 0) {
			if (prevSum.find(sum - 1) != prevSum.end()) {
				currlen = i - prevSum[sum - 1];
				maxlen = max(maxlen, currlen);
			}
		}
		if (prevSum.find(sum) == prevSum.end())
			prevSum[sum] = i;
	}
	return maxlen;
}
ll binaryToDecimal(string n) {
	string num = n;
	ll dec_value = 0;
	ll base = 1;
	ll len = num.length();
	for (ll i = len - 1; i >= 0; i--) {
		if (num[i] == '1')
			dec_value += base;
		base = base * 2;
	}
	return dec_value;
}
ll _gcd(ll a, ll b) {
	if (b > a) return _gcd(b, a);
	if (b == 0) return a;
	else return _gcd(b, a % b);
}
ll digitsum(ll num) {
	ll ans = 0;
	while (num > 0) {
		ans += num % 10;
		num /= 10;
	}
	return ans;
}
ll countbits(ll n) {
	ll cnt = 0;
	while (n > 0) {
		cnt++;
		n /= 2;
	}
	return cnt;
}
/*
bool *isprime = new bool[10000000] {false};
vector<ll> v;
void sieve() {
	isprime[0] = true;
	isprime[1] = true;
	for (ll i = 2; i * i < 10000000; i++) {
		if (isprime[i] == false) {
			for (ll j = i * 2; j < 10000000; j += i) {
				isprime[j] = true;
			}
		}
	}
}
*/
//ll *prime = new ll[10000000] {0};
/*
void sieve() {
	prime[1] = 1;
	for (ll i = 2; i * i < 10000000; i++) {
		if (prime[i] == 0) {
			for (ll j = i; j < 10000000; j += i) {
				prime[j] = i;
			}
		}
	}
}
*/
vector<ll> adj[200001];
ll color[200001];
bool visited[200001];
void dfs(ll src, ll c) {
	if (visited[src])
	{
		if (color[src] != c)
		{
			cout << "NO";
			exit(0);
		}
		return;
	}
	visited[src] = 1;
	color[src] = c;
	for (auto x : adj[src]) {
		dfs(x, 1 - c);
	}

}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll n, m; cin >> n >> m;
	ll x[n + 1], y[n + 1];
	rep(i, 0, m - 1) {
		cin >> x[i] >> y[i];
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}
	memset(color, -1, sizeof(color));
	dfs(1, 1);

	cout << "YES" << endl;
	for (int i = 0; i < m; i++) {
		cout << color[x[i]];
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define endl '\n'
ll getsum(string n) {
	ll ans = 0;
	for (ll i = 0; i < n.length(); i++) {
		ans += n[i] - '0';
	}
	return ans;
}
ll power(ll x, ll y, ll mod) {
	ll res = 1;
	x = x % mod;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}
ll power(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
string CONVERT_TO_BINARY(ll s) {
	string res = "";
	while (s != 0) {
		res += (char)('0' + s % 2);
		s /= 2;
	}
	reverse(res.begin() , res.end());
	return res;
}
bool PALIN(string s) {
	ll i = 0;
	ll j = s.length() - 1;
	while (i <= j) {
		if (s[i] != s[j]) return false;
		j-- , i++;
	}
	return true;
}
ll modInverse(ll a, ll m) {
	return power(a, m - 2);
}
ll findLongestSub(string bin) {
	ll n = bin.length(), i;
	ll sum = 0;
	unordered_map<ll, ll> prevSum;
	ll maxlen = 0;
	ll currlen;
	for (i = 0; i < n; i++) {
		if (bin[i] == '1')
			sum++;
		else sum--;
		if (sum > 0) {
			maxlen = i + 1;
		}
		else if (sum <= 0) {
			if (prevSum.find(sum - 1) != prevSum.end()) {
				currlen = i - prevSum[sum - 1];
				maxlen = max(maxlen, currlen);
			}
		}
		if (prevSum.find(sum) == prevSum.end())
			prevSum[sum] = i;
	}
	return maxlen;
}
ll binaryToDecimal(string n) {
	string num = n;
	ll dec_value = 0;
	ll base = 1;
	ll len = num.length();
	for (ll i = len - 1; i >= 0; i--) {
		if (num[i] == '1')
			dec_value += base;
		base = base * 2;
	}
	return dec_value;
}
ll _gcd(ll a, ll b) {
	if (b > a) return _gcd(b, a);
	if (b == 0) return a;
	else return _gcd(b, a % b);
}
ll digitsum(ll num) {
	ll ans = 0;
	while (num > 0) {
		ans += num % 10;
		num /= 10;
	}
	return ans;
}
ll countbits(ll n) {
	ll cnt = 0;
	while (n > 0) {
		cnt++;
		n /= 2;
	}
	return cnt;
}
/*
bool *isprime = new bool[10000000] {false};
vector<ll> v;
void sieve() {
	isprime[0] = true;
	isprime[1] = true;
	for (ll i = 2; i * i < 10000000; i++) {
		if (isprime[i] == false) {
			for (ll j = i * 2; j < 10000000; j += i) {
				isprime[j] = true;
			}
		}
	}
}
*/
//ll *prime = new ll[10000000] {0};
/*
void sieve() {
	prime[1] = 1;
	for (ll i = 2; i * i < 10000000; i++) {
		if (prime[i] == 0) {
			for (ll j = i; j < 10000000; j += i) {
				prime[j] = i;
			}
		}
	}
}
*/
vector<ll> adj[200001];
ll color[200001];

bool dfs(ll src, ll c) {
	color[src] = c;
	for (auto x : adj[src]) {
		if (color[x] == c) return false;
		if (color[x] == -1) {
			dfs(x, 1 - c);
		}
	}
	return true;
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll n, m; cin >> n >> m;
	rep(i, 0, m - 1) {
		ll x, y;
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	memset(color, -1, sizeof(color));
	bool ans = dfs(1, 1);
	if (ans) {
	cout<<"YES"<<endl;
		for (int i = 1; i <= n; i++) {
			cout << color[i];
		}
	}else cout<<"NO"<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define endl '\n'
ll getsum(string n) {
	ll ans = 0;
	for (ll i = 0; i < n.length(); i++) {
		ans += n[i] - '0';
	}
	return ans;
}
ll power(ll x, ll y, ll mod) {
	ll res = 1;
	x = x % mod;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}
ll power(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
string CONVERT_TO_BINARY(ll s) {
	string res = "";
	while (s != 0) {
		res += (char)('0' + s % 2);
		s /= 2;
	}
	reverse(res.begin() , res.end());
	return res;
}
bool PALIN(string s) {
	ll i = 0;
	ll j = s.length() - 1;
	while (i <= j) {
		if (s[i] != s[j]) return false;
		j-- , i++;
	}
	return true;
}
ll modInverse(ll a, ll m) {
	return power(a, m - 2);
}
ll findLongestSub(string bin) {
	ll n = bin.length(), i;
	ll sum = 0;
	unordered_map<ll, ll> prevSum;
	ll maxlen = 0;
	ll currlen;
	for (i = 0; i < n; i++) {
		if (bin[i] == '1')
			sum++;
		else sum--;
		if (sum > 0) {
			maxlen = i + 1;
		}
		else if (sum <= 0) {
			if (prevSum.find(sum - 1) != prevSum.end()) {
				currlen = i - prevSum[sum - 1];
				maxlen = max(maxlen, currlen);
			}
		}
		if (prevSum.find(sum) == prevSum.end())
			prevSum[sum] = i;
	}
	return maxlen;
}
ll binaryToDecimal(string n) {
	string num = n;
	ll dec_value = 0;
	ll base = 1;
	ll len = num.length();
	for (ll i = len - 1; i >= 0; i--) {
		if (num[i] == '1')
			dec_value += base;
		base = base * 2;
	}
	return dec_value;
}
ll _gcd(ll a, ll b) {
	if (b > a) return _gcd(b, a);
	if (b == 0) return a;
	else return _gcd(b, a % b);
}
ll digitsum(ll num) {
	ll ans = 0;
	while (num > 0) {
		ans += num % 10;
		num /= 10;
	}
	return ans;
}
ll countbits(ll n) {
	ll cnt = 0;
	while (n > 0) {
		cnt++;
		n /= 2;
	}
	return cnt;
}
/*
bool *isprime = new bool[10000000] {false};
vector<ll> v;
void sieve() {
	isprime[0] = true;
	isprime[1] = true;
	for (ll i = 2; i * i < 10000000; i++) {
		if (isprime[i] == false) {
			for (ll j = i * 2; j < 10000000; j += i) {
				isprime[j] = true;
			}
		}
	}
}
*/
//ll *prime = new ll[10000000] {0};
/*
void sieve() {
	prime[1] = 1;
	for (ll i = 2; i * i < 10000000; i++) {
		if (prime[i] == 0) {
			for (ll j = i; j < 10000000; j += i) {
				prime[j] = i;
			}
		}
	}
}
*/
vector<ll> adj[200001];
ll color[200001];

bool dfs(ll src, ll c) {
	color[src] = c;
	for (auto x : adj[src]) {
		if (color[x] == c) return false;
		if (color[x] == -1) {
			dfs(x, 1 - c);
		}
	}
	return true;
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll n, m; cin >> n >> m;
	ll x[n + 1], y[n + 1];
	rep(i, 0, m - 1) {
		cin >> x[i] >> y[i];
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}
	memset(color, -1, sizeof(color));
	bool ans = dfs(1, 1);
	if (ans) {
		cout << "YES" << endl;
		for (int i = 0; i < m; i++) {
			cout << color[x[i]];
		}
	} else cout << "NO" << endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define endl '\n'
ll getsum(string n) {
	ll ans = 0;
	for (ll i = 0; i < n.length(); i++) {
		ans += n[i] - '0';
	}
	return ans;
}
ll power(ll x, ll y, ll mod) {
	ll res = 1;
	x = x % mod;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}
ll power(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
string CONVERT_TO_BINARY(ll s) {
	string res = "";
	while (s != 0) {
		res += (char)('0' + s % 2);
		s /= 2;
	}
	reverse(res.begin() , res.end());
	return res;
}
bool PALIN(string s) {
	ll i = 0;
	ll j = s.length() - 1;
	while (i <= j) {
		if (s[i] != s[j]) return false;
		j-- , i++;
	}
	return true;
}
ll modInverse(ll a, ll m) {
	return power(a, m - 2);
}
ll findLongestSub(string bin) {
	ll n = bin.length(), i;
	ll sum = 0;
	unordered_map<ll, ll> prevSum;
	ll maxlen = 0;
	ll currlen;
	for (i = 0; i < n; i++) {
		if (bin[i] == '1')
			sum++;
		else sum--;
		if (sum > 0) {
			maxlen = i + 1;
		}
		else if (sum <= 0) {
			if (prevSum.find(sum - 1) != prevSum.end()) {
				currlen = i - prevSum[sum - 1];
				maxlen = max(maxlen, currlen);
			}
		}
		if (prevSum.find(sum) == prevSum.end())
			prevSum[sum] = i;
	}
	return maxlen;
}
ll binaryToDecimal(string n) {
	string num = n;
	ll dec_value = 0;
	ll base = 1;
	ll len = num.length();
	for (ll i = len - 1; i >= 0; i--) {
		if (num[i] == '1')
			dec_value += base;
		base = base * 2;
	}
	return dec_value;
}
ll _gcd(ll a, ll b) {
	if (b > a) return _gcd(b, a);
	if (b == 0) return a;
	else return _gcd(b, a % b);
}
ll digitsum(ll num) {
	ll ans = 0;
	while (num > 0) {
		ans += num % 10;
		num /= 10;
	}
	return ans;
}
ll countbits(ll n) {
	ll cnt = 0;
	while (n > 0) {
		cnt++;
		n /= 2;
	}
	return cnt;
}
/*
bool *isprime = new bool[10000000] {false};
vector<ll> v;
void sieve() {
	isprime[0] = true;
	isprime[1] = true;
	for (ll i = 2; i * i < 10000000; i++) {
		if (isprime[i] == false) {
			for (ll j = i * 2; j < 10000000; j += i) {
				isprime[j] = true;
			}
		}
	}
}
*/
//ll *prime = new ll[10000000] {0};
/*
void sieve() {
	prime[1] = 1;
	for (ll i = 2; i * i < 10000000; i++) {
		if (prime[i] == 0) {
			for (ll j = i; j < 10000000; j += i) {
				prime[j] = i;
			}
		}
	}
}
*/
vector<ll> adj[200010];
ll color[200010];
bool possible = true;
void dfs(ll src, ll c) {
	color[src] = c;
	for (auto x : adj[src]) {
		if (color[x] == -1) dfs(x, 1 - c);
		else if (color[x] == color[src]) possible = false;
	}
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll n, m; cin >> n >> m;
	ll x[n + 1], y[n + 1];
	for (int i = 0; i < m; i++) {
		cin >> x[i] >> y[i];
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}
	memset(color, -1, sizeof(color));
	dfs(1, 1);
	if (!possible) {
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
	for (int i = 0; i < m; i++) {
		cout << color[x[i]];
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define endl '\n'
ll getsum(string n) {
	ll ans = 0;
	for (ll i = 0; i < n.length(); i++) {
		ans += n[i] - '0';
	}
	return ans;
}
ll power(ll x, ll y, ll mod) {
	ll res = 1;
	x = x % mod;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}
ll power(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
string CONVERT_TO_BINARY(ll s) {
	string res = "";
	while (s != 0) {
		res += (char)('0' + s % 2);
		s /= 2;
	}
	reverse(res.begin() , res.end());
	return res;
}
bool PALIN(string s) {
	ll i = 0;
	ll j = s.length() - 1;
	while (i <= j) {
		if (s[i] != s[j]) return false;
		j-- , i++;
	}
	return true;
}
ll modInverse(ll a, ll m) {
	return power(a, m - 2);
}
ll findLongestSub(string bin) {
	ll n = bin.length(), i;
	ll sum = 0;
	unordered_map<ll, ll> prevSum;
	ll maxlen = 0;
	ll currlen;
	for (i = 0; i < n; i++) {
		if (bin[i] == '1')
			sum++;
		else sum--;
		if (sum > 0) {
			maxlen = i + 1;
		}
		else if (sum <= 0) {
			if (prevSum.find(sum - 1) != prevSum.end()) {
				currlen = i - prevSum[sum - 1];
				maxlen = max(maxlen, currlen);
			}
		}
		if (prevSum.find(sum) == prevSum.end())
			prevSum[sum] = i;
	}
	return maxlen;
}
ll binaryToDecimal(string n) {
	string num = n;
	ll dec_value = 0;
	ll base = 1;
	ll len = num.length();
	for (ll i = len - 1; i >= 0; i--) {
		if (num[i] == '1')
			dec_value += base;
		base = base * 2;
	}
	return dec_value;
}
ll _gcd(ll a, ll b) {
	if (b > a) return _gcd(b, a);
	if (b == 0) return a;
	else return _gcd(b, a % b);
}
ll digitsum(ll num) {
	ll ans = 0;
	while (num > 0) {
		ans += num % 10;
		num /= 10;
	}
	return ans;
}
ll countbits(ll n) {
	ll cnt = 0;
	while (n > 0) {
		cnt++;
		n /= 2;
	}
	return cnt;
}
/*
bool *isprime = new bool[10000000] {false};
vector<ll> v;
void sieve() {
	isprime[0] = true;
	isprime[1] = true;
	for (ll i = 2; i * i < 10000000; i++) {
		if (isprime[i] == false) {
			for (ll j = i * 2; j < 10000000; j += i) {
				isprime[j] = true;
			}
		}
	}
}
*/
//ll *prime = new ll[10000000] {0};
/*
void sieve() {
	prime[1] = 1;
	for (ll i = 2; i * i < 10000000; i++) {
		if (prime[i] == 0) {
			for (ll j = i; j < 10000000; j += i) {
				prime[j] = i;
			}
		}
	}
}
*/
vector<ll> adj[200010];
ll color[200010];
bool possible = true;
void dfs(ll src, ll c) {
	color[src] = c;
	for (auto x : adj[src]) {
		if (color[x] == -1) dfs(x, 1 - c);
		else if (color[x] == c) possible = false;
	}
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll n, m; cin >> n >> m;
	ll x[n + 1], y[n + 1];
	rep(i, 0, m - 1) {
		cin >> x[i] >> y[i];
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}
	memset(color, -1, sizeof(color));
	dfs(1, 1);
	if (!possible) {
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
	for (int i = 0; i < m; i++) {
		cout << color[x[i]];
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define endl '\n'
ll getsum(string n) {
	ll ans = 0;
	for (ll i = 0; i < n.length(); i++) {
		ans += n[i] - '0';
	}
	return ans;
}
ll power(ll x, ll y, ll mod) {
	ll res = 1;
	x = x % mod;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}
ll power(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
string CONVERT_TO_BINARY(ll s) {
	string res = "";
	while (s != 0) {
		res += (char)('0' + s % 2);
		s /= 2;
	}
	reverse(res.begin() , res.end());
	return res;
}
bool PALIN(string s) {
	ll i = 0;
	ll j = s.length() - 1;
	while (i <= j) {
		if (s[i] != s[j]) return false;
		j-- , i++;
	}
	return true;
}
ll modInverse(ll a, ll m) {
	return power(a, m - 2);
}
ll findLongestSub(string bin) {
	ll n = bin.length(), i;
	ll sum = 0;
	unordered_map<ll, ll> prevSum;
	ll maxlen = 0;
	ll currlen;
	for (i = 0; i < n; i++) {
		if (bin[i] == '1')
			sum++;
		else sum--;
		if (sum > 0) {
			maxlen = i + 1;
		}
		else if (sum <= 0) {
			if (prevSum.find(sum - 1) != prevSum.end()) {
				currlen = i - prevSum[sum - 1];
				maxlen = max(maxlen, currlen);
			}
		}
		if (prevSum.find(sum) == prevSum.end())
			prevSum[sum] = i;
	}
	return maxlen;
}
ll binaryToDecimal(string n) {
	string num = n;
	ll dec_value = 0;
	ll base = 1;
	ll len = num.length();
	for (ll i = len - 1; i >= 0; i--) {
		if (num[i] == '1')
			dec_value += base;
		base = base * 2;
	}
	return dec_value;
}
ll _gcd(ll a, ll b) {
	if (b > a) return _gcd(b, a);
	if (b == 0) return a;
	else return _gcd(b, a % b);
}
ll digitsum(ll num) {
	ll ans = 0;
	while (num > 0) {
		ans += num % 10;
		num /= 10;
	}
	return ans;
}
ll countbits(ll n) {
	ll cnt = 0;
	while (n > 0) {
		cnt++;
		n /= 2;
	}
	return cnt;
}
/*
bool *isprime = new bool[10000000] {false};
vector<ll> v;
void sieve() {
	isprime[0] = true;
	isprime[1] = true;
	for (ll i = 2; i * i < 10000000; i++) {
		if (isprime[i] == false) {
			for (ll j = i * 2; j < 10000000; j += i) {
				isprime[j] = true;
			}
		}
	}
}
*/
//ll *prime = new ll[10000000] {0};
/*
void sieve() {
	prime[1] = 1;
	for (ll i = 2; i * i < 10000000; i++) {
		if (prime[i] == 0) {
			for (ll j = i; j < 10000000; j += i) {
				prime[j] = i;
			}
		}
	}
}
*/
vector<ll> adj[200010];
ll color[200010];
bool possible = true;
void dfs(ll src, ll c) {
	color[src] = c;
	for (auto x : adj[src]) {
		if (color[x] == -1) dfs(x, 1 - c);
		else if (color[x] == color[src]) possible = false;
	}
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll n, m; cin >> n >> m;
	ll x[n + 1], y[n + 1];
	rep(i, 0, m - 1) {
		cin >> x[i] >> y[i];
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}
	memset(color, -1, sizeof(color));
	dfs(1, 1);
	if (!possible) {
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
	for (int i = 0; i < m; i++) {
		cout << color[x[i]];
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define endl '\n'
ll getsum(string n) {
	ll ans = 0;
	for (ll i = 0; i < n.length(); i++) {
		ans += n[i] - '0';
	}
	return ans;
}
ll power(ll x, ll y, ll mod) {
	ll res = 1;
	x = x % mod;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}
ll power(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
string CONVERT_TO_BINARY(ll s) {
	string res = "";
	while (s != 0) {
		res += (char)('0' + s % 2);
		s /= 2;
	}
	reverse(res.begin() , res.end());
	return res;
}
bool PALIN(string s) {
	ll i = 0;
	ll j = s.length() - 1;
	while (i <= j) {
		if (s[i] != s[j]) return false;
		j-- , i++;
	}
	return true;
}
ll modInverse(ll a, ll m) {
	return power(a, m - 2);
}
ll findLongestSub(string bin) {
	ll n = bin.length(), i;
	ll sum = 0;
	unordered_map<ll, ll> prevSum;
	ll maxlen = 0;
	ll currlen;
	for (i = 0; i < n; i++) {
		if (bin[i] == '1')
			sum++;
		else sum--;
		if (sum > 0) {
			maxlen = i + 1;
		}
		else if (sum <= 0) {
			if (prevSum.find(sum - 1) != prevSum.end()) {
				currlen = i - prevSum[sum - 1];
				maxlen = max(maxlen, currlen);
			}
		}
		if (prevSum.find(sum) == prevSum.end())
			prevSum[sum] = i;
	}
	return maxlen;
}
ll binaryToDecimal(string n) {
	string num = n;
	ll dec_value = 0;
	ll base = 1;
	ll len = num.length();
	for (ll i = len - 1; i >= 0; i--) {
		if (num[i] == '1')
			dec_value += base;
		base = base * 2;
	}
	return dec_value;
}
ll _gcd(ll a, ll b) {
	if (b > a) return _gcd(b, a);
	if (b == 0) return a;
	else return _gcd(b, a % b);
}
ll digitsum(ll num) {
	ll ans = 0;
	while (num > 0) {
		ans += num % 10;
		num /= 10;
	}
	return ans;
}
ll countbits(ll n) {
	ll cnt = 0;
	while (n > 0) {
		cnt++;
		n /= 2;
	}
	return cnt;
}
/*
bool *isprime = new bool[10000000] {false};
vector<ll> v;
void sieve() {
	isprime[0] = true;
	isprime[1] = true;
	for (ll i = 2; i * i < 10000000; i++) {
		if (isprime[i] == false) {
			for (ll j = i * 2; j < 10000000; j += i) {
				isprime[j] = true;
			}
		}
	}
}
*/
//ll *prime = new ll[10000000] {0};
/*
void sieve() {
	prime[1] = 1;
	for (ll i = 2; i * i < 10000000; i++) {
		if (prime[i] == 0) {
			for (ll j = i; j < 10000000; j += i) {
				prime[j] = i;
			}
		}
	}
}
*/
vector<ll> adj[200001];
ll color[200001];
bool possible = true;
void dfs(ll src, ll c) {
	color[src] = c;
	for (auto x : adj[src]) {
		if (color[x] == -1) dfs(x, 1 - c);
		else if (color[x] == c) possible = false;
	}
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll n, m; cin >> n >> m;
	ll x[n + 1], y[n + 1];
	rep(i, 0, m - 1) {
		cin >> x[i] >> y[i];
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}
	memset(color, -1, sizeof(color));
	dfs(1, 1);
	if (!possible) {
		cout << "NO" <<endl;
		return 0;
	}
	cout << "YES" << endl;
	for (int i = 0; i < m; i++) {
		cout << color[x[i]];
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define endl '\n'
ll getsum(string n) {
	ll ans = 0;
	for (ll i = 0; i < n.length(); i++) {
		ans += n[i] - '0';
	}
	return ans;
}
ll power(ll x, ll y, ll mod) {
	ll res = 1;
	x = x % mod;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}
ll power(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
string CONVERT_TO_BINARY(ll s) {
	string res = "";
	while (s != 0) {
		res += (char)('0' + s % 2);
		s /= 2;
	}
	reverse(res.begin() , res.end());
	return res;
}
bool PALIN(string s) {
	ll i = 0;
	ll j = s.length() - 1;
	while (i <= j) {
		if (s[i] != s[j]) return false;
		j-- , i++;
	}
	return true;
}
ll modInverse(ll a, ll m) {
	return power(a, m - 2);
}
ll findLongestSub(string bin) {
	ll n = bin.length(), i;
	ll sum = 0;
	unordered_map<ll, ll> prevSum;
	ll maxlen = 0;
	ll currlen;
	for (i = 0; i < n; i++) {
		if (bin[i] == '1')
			sum++;
		else sum--;
		if (sum > 0) {
			maxlen = i + 1;
		}
		else if (sum <= 0) {
			if (prevSum.find(sum - 1) != prevSum.end()) {
				currlen = i - prevSum[sum - 1];
				maxlen = max(maxlen, currlen);
			}
		}
		if (prevSum.find(sum) == prevSum.end())
			prevSum[sum] = i;
	}
	return maxlen;
}
ll binaryToDecimal(string n) {
	string num = n;
	ll dec_value = 0;
	ll base = 1;
	ll len = num.length();
	for (ll i = len - 1; i >= 0; i--) {
		if (num[i] == '1')
			dec_value += base;
		base = base * 2;
	}
	return dec_value;
}
ll _gcd(ll a, ll b) {
	if (b > a) return _gcd(b, a);
	if (b == 0) return a;
	else return _gcd(b, a % b);
}
ll digitsum(ll num) {
	ll ans = 0;
	while (num > 0) {
		ans += num % 10;
		num /= 10;
	}
	return ans;
}
ll countbits(ll n) {
	ll cnt = 0;
	while (n > 0) {
		cnt++;
		n /= 2;
	}
	return cnt;
}
/*
bool *isprime = new bool[10000000] {false};
vector<ll> v;
void sieve() {
	isprime[0] = true;
	isprime[1] = true;
	for (ll i = 2; i * i < 10000000; i++) {
		if (isprime[i] == false) {
			for (ll j = i * 2; j < 10000000; j += i) {
				isprime[j] = true;
			}
		}
	}
}
*/
//ll *prime = new ll[10000000] {0};
/*
void sieve() {
	prime[1] = 1;
	for (ll i = 2; i * i < 10000000; i++) {
		if (prime[i] == 0) {
			for (ll j = i; j < 10000000; j += i) {
				prime[j] = i;
			}
		}
	}
}
*/
vector<ll> adj[200010];
ll color[200010];
bool possible = true;
void dfs(ll src, ll c) {
	color[src] = c;
	for (auto &x : adj[src]) {
		if (color[x] == -1) dfs(x, 1 - c);
		else if (color[x] == color[src]) {
			cout << "NO" << endl;
			exit(0);
		}
	}
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll n, m; cin >> n >> m;
	ll x[n + 1], y[n + 1];
	for (int i = 0; i < m; i++) {
		cin >> x[i] >> y[i];
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}
	memset(color, -1, sizeof(color));
	dfs(1, 1);
	if (!possible) {

	}
	cout << "YES" << endl;
	for (int i = 0; i < m; i++) {
		cout << color[x[i]];
	}

}


#include <bits/stdc++.h>
#define in(x) freopen(x,"r",stdin)
#define out(x) freopen(x,"w",stdout)
#define N 100500*3
#define oo ll(1e9)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
int n,m,root,x[N],y[N];
bool mk[N],used[N];
vector<int> g[N];
void dfs(int v,int pr,bool o) {
    if(used[v]) return;
    used[v]=1;
    mk[v]=o;
    for(int i:g[v]) dfs(i,v,1-o);
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n>>m;
    for(int i=0;i<m;i++) {
		cin>>x[i]>>y[i]; x[i]--; y[i]--;
		root=x[i]; root=y[i];
		g[x[i]].pb(y[i]);
		g[y[i]].pb(x[i]);
    }
	dfs(root,-1,0);
    for(int i=0;i<m;i++) if(mk[x[i]]==mk[y[i]]) {cout<<"NO"; return 0;}
    cout<<"YES\n";
    for(int i=0;i<m;i++)
		if(!mk[x[i]]) cout<<1;
			else cout<<0;
}