class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: B = None
        self.q: B = None
        self.txt = txt

c = A("c")
i = B("i")
a = C("a")
b = C("b")
e = C("e")
l = B("l")
k = C("k")
h = A("h")
g = C("g")

c.r = h
c.o = h
i.x = l
i.v = c
a.y = i
a.v = i
a.q = i
b.y = i
b.v = l
b.q = l
e.y = i
e.v = l
e.q = l
l.x = i
l.v = c
k.y = i
k.q = i
k.v = l
h.r = c
h.o = c
g.y = l
g.q = l
g.v = i
assert h.o.r.r.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: B = None
        self.q: B = None
        self.txt = txt

c = A("c")
i = B("i")
a = C("a")
b = C("b")
e = C("e")
l = B("l")
k = C("k")
h = A("h")
g = C("g")

c.r = h
c.o = h
i.x = l
i.v = c
a.y = i
a.v = i
a.q = i
b.y = i
b.v = l
b.q = l
e.y = i
e.v = l
e.q = l
l.x = i
l.v = c
k.y = i
k.q = i
k.v = l
h.r = c
h.o = c
g.y = l
g.q = l
g.v = i
assert h.o.r.r.o.o.o.o.o.txt == "h"