Index: src/dgp/boubble.hh
===================================================================
--- src/dgp/boubble.hh	(revision 3b02b04ff9c7c3446ca477cd84c2bc7f737c38b4)
+++ src/dgp/boubble.hh	(revision 519eaf508529829bbfe93c12c3e94f44afccf5ed)
@@ -24,18 +24,22 @@
 {
 public:
-  Boubble(list<Role> u, list<Role> d, LongRel l, int s=-1);
-  Boubble(const char* pathstr, const char* l, int s=-1);
-  //  Boubble(const Boubble& b) {_src=b._src; _upath=b._upath; _dpath=b._dpath; _rel=b._rel; };
-
-  Dir dir();
-  LongRel rel();
-  int src();
+  Boubble() {};
+  Boubble(list<Role> u, list<Role> d, LongRel l, int s=-1, bool r=false);
+  Boubble(const char* pathstr, const char* l, int s=-1, bool r=false);
+  //Boubble(const Boubble& b) {_src=b._src; _upath=b._upath; _dpath=b._dpath; _rel=b._rel; _reverse=b._reverse; };
+
+  Dir dir() const;
+  LongRel rel() const;
+  int src() const;
   void src(int s);
+  bool reverse() const;
+  void reverse(bool b);
 
   Role next();
 
   Boubble* step(Role r, Dir d);
-  
-  bool is_at_target();
+  Boubble* reversed();
+  
+  bool is_at_target() const;
 
   bool operator==(Boubble const& b) const;
@@ -52,4 +56,5 @@
   list<Role>           _dpath;
   LongRel              _rel;
+  bool                 _reverse;
 
 };
@@ -58,10 +63,11 @@
 
 inline
-Boubble::Boubble(list<Role> u, list<Role> d, LongRel l, int s) : _upath(u), _dpath(d), _rel(l), _src(s) {}
-
-//----------------------------------------------------------------------------------------------------
-
-inline
-Boubble::Boubble(const char* pathstr, const char* l, int s)
+Boubble::Boubble(list<Role> u, list<Role> d, LongRel l, int s, bool r)
+  : _upath(u), _dpath(d), _rel(l), _src(s), _reverse(r) {}
+
+//----------------------------------------------------------------------------------------------------
+
+inline
+Boubble::Boubble(const char* pathstr, const char* l, int s, bool r)
 {
   Dir dir = UP;
@@ -83,10 +89,11 @@
   _rel = LongRel(l);
   _src = s;
-}
-
-//----------------------------------------------------------------------------------------------------
-
-inline
-Dir Boubble::dir()
+  _reverse = r;
+}
+
+//----------------------------------------------------------------------------------------------------
+
+inline
+Dir Boubble::dir() const
 { 
   if(!_upath.empty())
@@ -100,5 +107,5 @@
 
 inline
-LongRel Boubble::rel()
+LongRel Boubble::rel() const
 { return _rel; }
 
@@ -106,5 +113,5 @@
 
 inline
-int Boubble::src()
+int Boubble::src() const
 { return _src; }
 
@@ -114,4 +121,16 @@
 void Boubble::src(int s)
 { _src=s; }
+
+//----------------------------------------------------------------------------------------------------
+
+inline
+bool Boubble::reverse() const
+{ return _reverse; }
+
+//----------------------------------------------------------------------------------------------------
+
+inline
+void Boubble::reverse(bool b)
+{ _reverse=b; }
 
 //----------------------------------------------------------------------------------------------------
@@ -134,5 +153,5 @@
   if(d==UP && !_upath.empty() && _upath.front() == r)
     {
-      Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src);
+      Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src,_reverse);
       newboubble->_upath.pop_front();
       return newboubble;
@@ -141,5 +160,5 @@
   if(d==DOWN && _upath.empty() && !_dpath.empty() && _dpath.front() == r)
     {
-      Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src);
+      Boubble* newboubble = new Boubble(_upath,_dpath,_rel,_src,_reverse);
       newboubble->_dpath.pop_front();
       return newboubble;
@@ -151,5 +170,17 @@
 
 inline
-bool Boubble::is_at_target()
+Boubble* Boubble::reversed()
+{
+  Boubble* newboubble = new Boubble(_dpath,_upath,_rel,-1,!_reverse);
+  newboubble->_upath.reverse();
+  newboubble->_dpath.reverse();
+  // cout << *this << "-----" << *newboubble << endl;
+  return newboubble;
+}
+
+//----------------------------------------------------------------------------------------------------
+
+inline
+bool Boubble::is_at_target() const
 { return _upath.empty() && _dpath.empty(); }
 
@@ -208,4 +239,6 @@
   o << b._rel.str();
   o << "]";
+  if(b.reverse()) o << "!";
+  return o;
 }
 
Index: src/dgp/dgp1.cc
===================================================================
--- src/dgp/dgp1.cc	(revision b97a55609b527df1f92edbe0c70d03a6385c0132)
+++ src/dgp/dgp1.cc	(revision 519eaf508529829bbfe93c12c3e94f44afccf5ed)
@@ -1,2 +1,5 @@
+#include <iostream>
+using namespace std;
+
 #include "dgp0.hh"
 #include "global.hh"
@@ -79,9 +82,9 @@
 	  {
 	    ret = *ps;
-	    // fprintf(stderr,"FIND EXISTING NODE SUCCEEDED BEACAUSE OF LH/LV equality ()\n");
+	    fprintf(stderr,"#\tsucceeded because of LH/LV equality ()\n");
 	  }
 	else
 	  {
-	    // fprintf(stderr,"FIND EXISTING NODE FAILED BEACAUSE OF LH/LV inequality\n");
+	    fprintf(stderr,"#\tfailed beacause of LH/LV inequality\n");
 	  }
     }
@@ -158,28 +161,24 @@
 //====================================================================================================
 
-int create_new_head_node_left(int h, NodeProp& newheadprop, bitset<MAXNODES>& newheadLH, bitset<MAXNODES>& newheadLD, bitset<MAXNODES>& newheadLV)
-{
-  int newheadind = sgraph.clone(h,newheadprop);
-  // list<int>::iterator nextit=h; ++nextit;
-  // nodelist.insert(nextit,newheadind);
+int create_new_head_node_left(int anc, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV)
+{
+  int newheadind = sgraph.clone(anc,prop);
   nodelist.push_back(newheadind);
-  sgraph[newheadind].LH=newheadLH;
-  sgraph[newheadind].LD = newheadLD;
-  sgraph[newheadind].in_LH=true;
+  sgraph[newheadind].LH = LH;
+  sgraph[newheadind].LD = LD;
+  sgraph[newheadind].in_LH = true;
   sgraph[newheadind].LV.reset();
 
-  copy_links(h,newheadind);
+  copy_links(anc,newheadind);
   create_reverse_links(newheadind);
   
-  if(debug) sgraph.print_node_debug(stderr,"C ",newheadind,h);
+  if(debug) sgraph.print_node_debug(stderr,"add new",newheadind,anc);
   // if(debug) print_sets(newheadind);
   return newheadind;
 }
 
-int create_new_dep_node_left(int d, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV)
-{
-  int newind = sgraph.clone(d,prop);
-  // list<int>::iterator nextit=d; ++nextit;
-  // nodelist.insert(nextit,newind);
+int create_new_dep_node_left(int anc, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV)
+{
+  int newind = sgraph.clone(anc,prop);
   nodelist.push_back(newind);
   sgraph[newind].LH.reset();
@@ -188,8 +187,8 @@
   sgraph[newind].LV.reset();
 
-  copy_links(d,newind);
+  copy_links(anc,newind);
   create_reverse_links(newind);
   
-  if(debug) sgraph.print_node_debug(stderr,"C ",newind,d);
+  if(debug) sgraph.print_node_debug(stderr,"add new",newind,anc);
   // if(debug) print_sets(newind);
   
@@ -197,9 +196,7 @@
 }
 
-int create_new_head_node_right(int h, NodeProp& newheadprop, bitset<MAXNODES>& newheadLH, bitset<MAXNODES>& newheadLD, bitset<MAXNODES>& newheadLV)
-{
-  int newheadind = sgraph.clone(h,newheadprop);
-  // list<int>::iterator nextit=h; ++nextit;
-  // nodelist.insert(nextit,newheadind);
+int create_new_head_node_right(int anc, NodeProp& prop, bitset<MAXNODES>& newheadLH, bitset<MAXNODES>& newheadLD, bitset<MAXNODES>& newheadLV)
+{
+  int newheadind = sgraph.clone(anc,prop);
   nodelist.push_back(newheadind);
   sgraph[newheadind].LH=newheadLH;
@@ -208,8 +205,8 @@
   sgraph[newheadind].LV=newheadLV;
   
-  copy_links(h,newheadind);
+  copy_links(anc,newheadind);
   create_reverse_links(newheadind);
 
-  if(debug) sgraph.print_node_debug(stderr,"C ",newheadind,h);
+  if(debug) sgraph.print_node_debug(stderr,"add new",newheadind,anc);
   // if(debug) print_sets(newheadind);
   
@@ -217,7 +214,7 @@
 }
 
-int create_new_dep_node_right(int d, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV)
-{
-  int newind = sgraph.clone(d,prop);
+int create_new_dep_node_right(int anc, NodeProp& prop, bitset<MAXNODES>& LH, bitset<MAXNODES>& LD, bitset<MAXNODES>& LV)
+{
+  int newind = sgraph.clone(anc,prop);
   nodelist.push_back(newind);
   sgraph[newind].LH=LH;
@@ -226,8 +223,8 @@
   sgraph[newind].LV.reset();
   
-  copy_links(d,newind);
+  copy_links(anc,newind);
   create_reverse_links(newind);
 
-  if(debug) sgraph.print_node_debug(stderr,"C ",newind,d);
+  if(debug) sgraph.print_node_debug(stderr,"ADD NEW",newind,anc);
   // if(debug) print_sets(newind);
   
@@ -253,6 +250,4 @@
     bitset<MAXNODES> newheadLV = sgraph[d].LV;
     bitset<MAXNODES> newheadLD = sgraph[h].LD;
-
-    //    vector<int> newedge;
 
     newheadind = find_existing_node(sgraph[h].mnode, newheadprop, newheadLH, newheadLV);
@@ -302,8 +297,8 @@
   if(sgraph[d].saturated()) sgraph[newheadind].LD |= sgraph[d].LD;
   
-  if(debug) sgraph.print_arc(stderr,newheadind,d,l.role,0);
-  if(debug) sgraph.print_node_debug(stderr,"U ",newheadind,h);
+  if(debug) sgraph.print_arc(stderr,"new link",newheadind,d,l.role,0);
+  if(debug) sgraph.print_node_debug(stderr,"update",newheadind,h);
   // if(debug) print_sets(newheadind);
-  if(debug) sgraph.print_node_debug(stderr,"U ",newdepind,d);
+  if(debug) sgraph.print_node_debug(stderr,"update",newdepind,d);
   // if(debug) print_sets(newdepind);
 }
@@ -380,8 +375,85 @@
   if(sgraph[newheadind].saturated()) sgraph[newdepind].LH |= sgraph[newheadind].LH;
 
-  if(debug) sgraph.print_arc(stderr,newheadind,newdepind,l.role,1);
-  if(debug) sgraph.print_node_debug(stderr,"U ",newheadind,h);
-  if(debug) sgraph.print_node_debug(stderr,"U ",newdepind,d);
-  
+  if(debug) sgraph.print_arc(stderr,"new link",newheadind,newdepind,l.role,1);
+  if(debug) sgraph.print_node_debug(stderr,"update",newheadind,h);
+  if(debug) sgraph.print_node_debug(stderr,"update",newdepind,d);
+  
+}
+
+//====================================================================================================
+
+// bool check_meeting_boubles(list<Boubble*>& hboubbles, list<Boubble*>& dboubbles)
+// {
+//   bool hremove=false;             // czy usun±æ ostatnio sprawdzany b±bel
+//   bool dremove=false;             // czy usun±æ ostatnio sprawdzany b±bel
+
+//   for(list<Boubble*>::iterator hb = hboubbles.begin(); hb != hboubbles.end(); hb = hremove ? hboubbles.erase(hb) : ++hb )
+//     {
+//       hremove=false;
+//       for(list<Boubble*>::iterator db = dboubbles.begin(); db != dboubbles.end(); db = dremove ? dboubbles.erase(db) : ++db )
+// 	{
+// 	  dremove=false;
+// 	  if( (*hb)->rel()==(*db)->rel() && (*hb)->dir()==DOWN && (*db)->dir()==UP && (*hb)->reverse()!=(*db)->reverse() )
+// 	    {
+// 	      int srcnode,dstnode;
+// 	      if( (*hb)->reverse()==false )
+// 		srcnode = (*hb)->src(), dstnode = (*db)->src();
+// 	      else
+// 		srcnode = (*db)->src(), dstnode = (*hb)->src();
+// 	      if( grammar.check_longrel(sgraph.cat(srcnode), sgraph.cat(dstnode), (*hb)->rel()) )
+// 		{
+// 		  hremove=dremove=true;
+// 		  if(debug) fprintf(stderr,"BOUBBLES MET!!!\n");
+// 		}
+// 	      else
+// 		{
+// 		  if(debug) fprintf(stderr,"BOUBBLES' MEETING FAILED!!!\n");
+// 		  return false;
+// 		}
+// 	    }
+// 	}
+//     }
+//   return true;
+// }
+
+//====================================================================================================
+
+bool check_meeting_boubles(list<Boubble*>& boubbles)
+{
+  bool hremove=false;             // czy usun±æ ostatnio sprawdzany b±bel
+  bool dremove=false;             // czy usun±æ ostatnio sprawdzany b±bel
+
+  for(list<Boubble*>::iterator hb = boubbles.begin(); hb != boubbles.end(); hb = hremove ? boubbles.erase(hb) : ++hb )
+    {
+      cout << endl << "hb:" << **hb ;
+      hremove=false;
+      for(list<Boubble*>::iterator db = hb; db != boubbles.end(); db = dremove ? boubbles.erase(db) : ++db )
+	{
+	  cout << " db:" << **db;
+	  dremove=false;
+	  if( (*hb)->rel()==(*db)->rel() && (*hb)->reverse()!=(*db)->reverse() )
+	    {
+	      cout << "Z";
+	      int srcnode,dstnode;
+	      if( (*hb)->reverse()==false )
+		srcnode = (*hb)->src(), dstnode = (*db)->src();
+	      else
+		srcnode = (*db)->src(), dstnode = (*hb)->src();
+	      if( grammar.check_longrel(sgraph.cat(srcnode), sgraph.cat(dstnode), (*hb)->rel()) )
+		{
+		  cout << " REMOVE ";
+		  hremove=dremove=true;
+		  if(debug) fprintf(stderr,"BOUBBLES MET!!!\n");
+		}
+	      else
+		{
+		  cout << " FAIL ";
+		  if(debug) fprintf(stderr,"BOUBBLES' MEETING FAILED!!!\n");
+		  return false;
+		}
+	    }
+	}
+    }
+  return true;
 }
 
@@ -393,5 +465,4 @@
 bool check_boubbles_at_target(list<Boubble*>& boubbles, int node)
 {
-  list<Boubble*>::iterator last; // ostatnio sprawdzany b±bel
   bool remove=false;             // czy usun±æ ostatnio sprawdzany b±bel
 
@@ -399,5 +470,8 @@
     if( (*b)->is_at_target() )
       if( grammar.check_longrel(sgraph.cat((*b)->src()), sgraph.cat(node), (*b)->rel()) )
-	remove=true;
+	{
+	  cout << endl << "REMOVE ChBatT " << **b << endl;
+	  remove=true;
+	}
       else
 	return false;
@@ -412,75 +486,91 @@
 void try_connect_dependents(int j)
 {
-  // for(list<int>::iterator i(j); i!=nodelist.begin(); --i)
-  //   if(sgraph.visible(*i,*j) && sgraph.saturated(*i))
   LViterator lvi(sgraph,j);
   int i;
   while((i=lvi.next()) >= 0)
-    if(sgraph.saturated(i))
-      {
-      if(debug) {fprintf(stderr,"## %d <-- %d ... ",i,j); }
-
-      list<const Link*> ji_links = grammar.connectable2( sgraph.cat(j), sgraph.cat(i), sgraph[j].prop.flags, sgraph[i].prop.flags); // ref do Roles!!!
-      list<const Link*>::iterator ri = ji_links.begin();
-      if(ri == ji_links.end()) { if(debug) fprintf(stderr,"no roles\n"); }
+    {
+      //if(debug) sgraph.print_node_debug(stderr,"D-CUR>",i,-1);
+
+      if(sgraph.saturated(i))
+	{
+	  if(debug) {fprintf(stderr,"%d <--",i); }
+	  
+	  list<const Link*> ji_links = grammar.connectable2( sgraph.cat(j), sgraph.cat(i), sgraph[j].prop.flags, sgraph[i].prop.flags); // ref do Roles!!!
+	  list<const Link*>::iterator ri = ji_links.begin();
+	  if(ri == ji_links.end()) { if(debug) fprintf(stderr,"     no roles\n"); }
+	  else
+	    {
+	      for(; ri != ji_links.end(); ++ri )
+		{
+		  if(debug) fprintf(stderr,"     %s",(*ri)->role.str());
+		  if(!grammar.check_constr2(sgraph[j].prop,sgraph[i].prop,0,**ri ))
+		    { if(debug) fprintf(stderr," ...constraints failed\n"); }
+		  else
+		    {
+		      list<Boubble*> new_head_boubbles = collect_head_boubbles(j,i,(*ri)->role);
+		      list<Boubble*> new_dep_boubbles = collect_dep_boubbles(j,i,(*ri)->role);
+		      if( check_meeting_boubles(new_head_boubbles) &&
+			  check_meeting_boubles(new_dep_boubbles) &&
+			  check_boubbles_at_target(new_head_boubbles,j) &&
+			  check_boubbles_at_target(new_dep_boubbles,i) )
+			{
+			  if(debug) fprintf(stderr," ...SUCCESS!\n");
+			  connect_left( j, i, **ri, new_head_boubbles, new_dep_boubbles);
+			}
+		      else
+			{ if(debug) fprintf(stderr," ...boubbles failed\n"); }
+		    }
+		}
+	    }
+	}
       else
-	{
-	  for(; ri != ji_links.end(); ++ri )
-	    if(!grammar.check_constr2(sgraph[j].prop,sgraph[i].prop,0,**ri ))
-	      { if(debug) fprintf(stderr,"constraints failed\n"); }
-	    else
-	      {
-		list<Boubble*> new_head_boubbles = collect_head_boubbles(j,i,(*ri)->role);
-		list<Boubble*> new_dep_boubbles = collect_dep_boubbles(j,i,(*ri)->role);
-		
-		if( !(check_boubbles_at_target(new_head_boubbles,j) && check_boubbles_at_target(new_dep_boubbles,i)) )
-		  { if(debug) fprintf(stderr,"boubbles failed\n"); }
-		else
-		  {
-		    if(debug) fprintf(stderr,"success\n");
-		    connect_left( j, i, **ri, new_head_boubbles, new_dep_boubbles);
-		  }
-	      }
-	}
-    }
-}
-
-
+	  if(debug) {fprintf(stderr,"%d <--     unsaturated\n",i); }
+    }
+  
+}
 //----------------------------------------------------------------------------------------------------
 
 void try_connect_heads(int j)
 {
-  // for(list<int>::iterator i(j); i!=nodelist.begin(); --i)
-  //   if(sgraph.visible(*i,*j) && sgraph.saturated(*j))
-
   LViterator lvi(sgraph,j);
   int i;
   while((i=lvi.next()) >= 0)
-    if(sgraph.saturated(j))
-    {
-      if(debug) fprintf(stderr, "## %d --> %d ... ",i,j);
-
-      list<const Link*> ij_links = grammar.connectable2( sgraph.cat(i), sgraph.cat(j), sgraph[i].prop.flags, sgraph[j].prop.flags );
-      list<const Link*>::iterator ri = ij_links.begin();
-      if(ri == ij_links.end()) { if(debug) fprintf(stderr,"no roles\n"); }
+    {
+      // if(debug) sgraph.print_node_debug(stderr,"H-CUR> ",i,-1);
+      if(sgraph.saturated(j))
+	{
+	  if(debug) fprintf(stderr, "%d -->",i);
+	  
+	  list<const Link*> ij_links = grammar.connectable2( sgraph.cat(i), sgraph.cat(j), sgraph[i].prop.flags, sgraph[j].prop.flags );
+	  list<const Link*>::iterator ri = ij_links.begin();
+	  if(ri == ij_links.end()) { if(debug) fprintf(stderr,"     no roles\n"); }
+	  else
+	    {
+	      for(; ri != ij_links.end(); ++ri )
+		{
+		  if(debug) fprintf(stderr,"     %s",(*ri)->role.str());
+		  if( !grammar.check_constr2( sgraph[i].prop, sgraph[j].prop, 1, **ri ) )
+		    { if(debug) fprintf(stderr," ...constraints failed\n"); }
+		  else
+		    {
+		      list<Boubble*> new_head_boubbles = collect_head_boubbles(i,j,(*ri)->role);
+		      list<Boubble*> new_dep_boubbles = collect_dep_boubbles(i,j,(*ri)->role);
+		      
+		      if( check_meeting_boubles(new_head_boubbles) &&
+			  check_meeting_boubles(new_dep_boubbles) &&
+			  check_boubbles_at_target(new_head_boubbles,i) &&
+			  check_boubbles_at_target(new_dep_boubbles,j) )
+			{
+			  if(debug) fprintf(stderr," ...SUCCESS!\n");
+			  connect_right( i, j, **ri, new_head_boubbles, new_dep_boubbles );
+			}
+		      else
+			{ if(debug) fprintf(stderr," ...bubbles failed\n",i); }
+		    }
+		}
+	    }
+	}
       else
-	{
-	  for(; ri != ij_links.end(); ++ri )
-	    if( !grammar.check_constr2( sgraph[i].prop, sgraph[j].prop, 1, **ri ) )
-	      { if(debug) fprintf(stderr,"constraints failed\n"); }
-	    else
-	      {
-		list<Boubble*> new_head_boubbles = collect_head_boubbles(i,j,(*ri)->role);
-		list<Boubble*> new_dep_boubbles = collect_dep_boubbles(i,j,(*ri)->role);
-		
-		if( !(check_boubbles_at_target(new_head_boubbles,i) && check_boubbles_at_target(new_dep_boubbles,j)) )
-		  { if(debug) fprintf(stderr,"boubbles failed\n"); }
-		else
-		  {
-		    if(debug) fprintf(stderr,"success\n");
-		    connect_right( i, j, **ri, new_head_boubbles, new_dep_boubbles );
-		  }
-	      }
-	}
+	  if(debug) {fprintf(stderr,"%d <--     unsaturated\n",j); }
     }
 }
@@ -571,11 +661,11 @@
     nodelist.push_back(basenode);
 
-    if(debug) sgraph.print_node_debug(stderr,"B ",basenode,-1); // STDOUT!!!
-    if(debug) print_sets(basenode);
+    if(debug) sgraph.print_node_debug(stderr,"add base",basenode,-1); // STDOUT!!!
+    // if(debug) print_sets(basenode);
 
     list<int>::iterator cursor=processed;
     while(++cursor != nodelist.end())
     {
-      if(debug) sgraph.print_node_debug(stderr,"> ",*cursor,-1);
+      if(debug) sgraph.print_node_debug(stderr,"MAIN-CUR> ",*cursor,-1);
       try_connect_dependents(*cursor);
       try_connect_heads(*cursor);
Index: src/dgp/grammar.hh
===================================================================
--- src/dgp/grammar.hh	(revision a15e59b825ae3aa1d5f3555afaf4cdbf22beda62)
+++ src/dgp/grammar.hh	(revision 519eaf508529829bbfe93c12c3e94f44afccf5ed)
@@ -118,5 +118,5 @@
   vector< vector< LongRels > > longrel;  //[Cat][Cat]
 
-  list< Boubble* >              boubbles;
+  list< Boubble* >             boubbles;
   
   vector< vector< list<Boubble*> > >   uptrigger;//[Cat][Role]
@@ -126,5 +126,6 @@
   void add_type(const char* s);
   void add_flag(const char* s)                   { Flag::add(s); }
-  void add_long(const char* l, const char* p)    { LongRel::add(l); boubbles.push_back( new Boubble(p,l) ); }
+  void add_long(const char* l, const char* p)    { LongRel::add(l); boubbles.push_back( new Boubble(p,l) );
+                                                                    boubbles.push_back( (new Boubble(p,l))->reversed() ); }
   void add_triggers(Cat h, Cat d, LongRel l);
 
Index: src/dgp/sgraph.cc
===================================================================
--- src/dgp/sgraph.cc	(revision b97a55609b527df1f92edbe0c70d03a6385c0132)
+++ src/dgp/sgraph.cc	(revision 519eaf508529829bbfe93c12c3e94f44afccf5ed)
@@ -29,4 +29,6 @@
 
   newnode.edge.push_back(lastnodeind());
+
+  newnode.edge_contains_self = true ;
 
   return lastnodeind();
@@ -85,10 +87,10 @@
 //----------------------------------------------------------------------------------------------------
 
-void SGraph::print_arc(FILE* f, int head, int dep, Role role, int dir) // 0 - left, 1 - right
+void SGraph::print_arc(FILE* f, const char* msg, int head, int dep, Role role, int dir) // 0 - left, 1 - right
 {
   if(dir==0)
-    fprintf(f,"#A  %s:%d <-- %d\n", role.str(), dep, head);
+    fprintf(f,"%s  %s:%d <-- %d\n", msg, role.str(), dep, head);
   else
-    fprintf(f,"#A  %s:%d --> %d\n", role.str(), head, dep);
+    fprintf(f,"%s  %s:%d --> %d\n", msg, role.str(), head, dep);
 }
 
@@ -113,8 +115,5 @@
     for(vector<Arc>::iterator h=node.heads.begin(); h!=node.heads.end(); ++h)
     {
-      // if(cont) buf+=sprintf(buf,","); else cont=true;
       buf+=sprintf(buf,"(++%s:%d)",h->role.str(),h->dst);
-      // buf+=sprintf(buf,"++%s-%d(%d~%d)",h->role.str(),h->dst,h->headanc,h->depanc);
-      // buf+=sprintf(buf,"(<-%s-%d)",h->role.str(),h->dst);
     }
 
@@ -122,9 +121,5 @@
     for(vector<Arc>::iterator d=node.deps.begin(); d!=node.deps.end(); ++d)
     {
-      //      if(! nodes[d->dst].saturated()) continue; // NIE DRUKUJ NIENASYCONYCH PODRZEDNIKOW
-      // if(cont) buf+=sprintf(buf,","); else cont=true;
       buf+=sprintf(buf,"(--%s:%d)",d->role.str(),d->dst);
-      // buf+=sprintf(buf,"--%s-%d(%d~%d)",d->role.str(),d->dst,d->headanc,d->depanc);
-      // buf+=sprintf(buf,"(-%s->%d)",d->role.str(),d->dst);
     }
   
@@ -177,13 +172,14 @@
 {
   char *buf0 = buf;
-  buf+=sprintf(buf,"#%s",pref);
-
-  buf+=sprintf(buf,"%-16s",form(n));
-
+  buf+=sprintf(buf,"%-10s",pref);
+  buf+=sprintf(buf,"%d.%s",n,form(n));
+  buf+=sprintf(buf,";");
+  buf+=sprintf(buf,"%s ",cat(n).str());
+  while(buf-buf0<40) buf+=sprintf(buf," ");
   buf+=sprint_node(buf,n,anc,HEADS|DEPS|SETS|CONSTRAINTS);
   
-  buf+=sprintf(buf,"/");
-  for(vector<int>::iterator e = nodes[n].edge.begin(); e != nodes[n].edge.end(); e++ )
-    buf += sprintf(buf,"%d ", *e);
+  // buf+=sprintf(buf,"/");
+  // for(vector<int>::iterator e = nodes[n].edge.begin(); e != nodes[n].edge.end(); e++ )
+  //   buf += sprintf(buf,"%d ", *e);
 
   buf+=sprintf(buf,"\n");
Index: src/dgp/sgraph.hh
===================================================================
--- src/dgp/sgraph.hh	(revision 3b02b04ff9c7c3446ca477cd84c2bc7f737c38b4)
+++ src/dgp/sgraph.hh	(revision 519eaf508529829bbfe93c12c3e94f44afccf5ed)
@@ -228,5 +228,5 @@
   int print_node_debug(FILE* f, const char* pref, int n, int anc);
 
-  void print_arc(FILE* f, int left, int right, Role role, int dir); // 0 - left, 1 - right
+  void print_arc(FILE* f, const char* msg, int left, int right, Role role, int dir); // 0 - left, 1 - right
 
   //private:
@@ -327,9 +327,4 @@
       
     }
-  // if(!strict)
-  //   {
-  //     push_ld(n);
-  //     	  push_ln(n);
-  //   }
 }
 
