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

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: C = None
        self.u: B = None
        self.txt = txt

b = A("b")
g = B("g")
n = C("n")
j = B("j")
c = C("c")
k = C("k")
e = B("e")
i = B("i")
h = B("h")

b.v = h
g.r = b
g.q = c
n.o = e
n.r = k
n.u = j
j.r = b
j.q = n
c.o = g
c.r = n
c.u = i
k.o = e
k.r = n
k.u = g
e.r = b
e.q = c
i.r = b
i.q = k
h.r = b
h.q = c
assert e.q.u.r.v.q.u.q.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: C = None
        self.u: B = None
        self.txt = txt

b = A("b")
g = B("g")
n = C("n")
j = B("j")
c = C("c")
k = C("k")
e = B("e")
i = B("i")
h = B("h")

b.v = h
g.r = b
g.q = c
n.o = e
n.r = k
n.u = j
j.r = b
j.q = n
c.o = g
c.r = n
c.u = i
k.o = e
k.r = n
k.u = g
e.r = b
e.q = c
i.r = b
i.q = k
h.r = b
h.q = c
assert e.q.u.r.v.q.u.q.o.q.txt == "c"