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

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

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

l = A("l")
k = B("k")
n = C("n")
h = B("h")
j = C("j")
e = B("e")
c = A("c")
b = A("b")
a = C("a")
d = C("d")

l.x = e
l.u = a
l.v = k
k.o = e
n.q = h
n.s = c
h.o = e
j.q = k
j.s = b
e.o = h
c.x = e
c.u = n
c.v = h
b.x = k
b.u = n
b.v = h
a.q = h
a.s = l
d.q = e
d.s = c
assert b.v.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: C = None
        self.v: B = None
        self.txt = txt

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

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

l = A("l")
k = B("k")
n = C("n")
h = B("h")
j = C("j")
e = B("e")
c = A("c")
b = A("b")
a = C("a")
d = C("d")

l.x = e
l.u = a
l.v = k
k.o = e
n.q = h
n.s = c
h.o = e
j.q = k
j.s = b
e.o = h
c.x = e
c.u = n
c.v = h
b.x = k
b.u = n
b.v = h
a.q = h
a.s = l
d.q = e
d.s = c
assert b.v.o.o.o.o.o.txt == "e"