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

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

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

k = A("k")
c = B("c")
h = C("h")
m = B("m")
i = A("i")
d = C("d")
j = A("j")
f = C("f")
b = B("b")
e = B("e")

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

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

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

k = A("k")
c = B("c")
h = C("h")
m = B("m")
i = A("i")
d = C("d")
j = A("j")
f = C("f")
b = B("b")
e = B("e")

k.o = c
k.x = i
c.x = m
h.o = k
h.v = k
h.s = m
m.x = c
i.o = e
i.x = j
d.o = k
d.v = i
d.s = c
j.o = c
j.x = k
f.o = i
f.v = i
f.s = m
b.x = c
e.x = b
assert d.o.x.x.o.x.x.x.x.x.x.txt == "c"