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

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

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

b = A("b")
i = B("i")
f = C("f")
j = C("j")
l = C("l")
d = C("d")
e = B("e")
g = A("g")
h = A("h")
c = B("c")

b.s = h
b.x = g
b.o = c
i.x = b
f.o = d
j.o = d
l.o = f
d.o = j
e.x = g
g.s = h
g.x = b
g.o = e
h.s = g
h.x = b
h.o = i
c.x = b
assert l.o.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: A = None
        self.o: B = None
        self.txt = txt

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

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

b = A("b")
i = B("i")
f = C("f")
j = C("j")
l = C("l")
d = C("d")
e = B("e")
g = A("g")
h = A("h")
c = B("c")

b.s = h
b.x = g
b.o = c
i.x = b
f.o = d
j.o = d
l.o = f
d.o = j
e.x = g
g.s = h
g.x = b
g.o = e
h.s = g
h.x = b
h.o = i
c.x = b
assert l.o.o.o.o.o.o.o.o.txt == "d"